Raised This Month: $51 Target: $400
 12% 

New Syntax Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OXYD
AlliedModders Donor
Join Date: Aug 2019
Location: pluto
Old 04-05-2020 , 07:23   New Syntax Help
Reply With Quote #1

Hello! I'm trying to adapt a script to new syntax. But i don't know how to adapt this line:
HTML Code:
decl String:sTime[64], iCurrentTime[2], iStartTime[2], iEndTime[2];
I've tryed this
HTML Code:
char[64] sTime, char[2] iCurrentTime, char[2] iStartTime, char[2] iEndTime;
But i get this errors
HTML Code:
(52) : error 140: new-style array types cannot specify dimension sizes as part of their type
(52) : warning 215: expression has no effect
(52) : error 001: expected token: ";", but found "]"
(52) : error 029: invalid expression, assumed zero
(52) : fatal error 190: too many error messages on one line
P.S: I'm a beginner
__________________
ADD ME ON STEAM - https://steamcommunity.com/id/kenoxyd
89.40.104.210:27015 // COMPETITIVE SERVER
DISCORD: KENOXYD#9098

Last edited by OXYD; 04-05-2020 at 07:25.
OXYD is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 04-05-2020 , 07:53   Re: New Syntax Help
Reply With Quote #2

PHP Code:
char sTime[64];
int iCurrentTime[2], iStartTime[2], iEndTime[2]; 
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
OXYD
AlliedModders Donor
Join Date: Aug 2019
Location: pluto
Old 04-05-2020 , 09:43   Re: New Syntax Help
Reply With Quote #3

It worked, thanks
And one more question

If i have this:
HTML Code:
static const char g_sStartTime[ ][ ] = { "01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00","09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00", "00:00" }
How should i create this convar?

HTML Code:
	hCvar = CreateConVar("sm_ac_time_start", "23:00", "System start hour:");
	HookConVarChange(hCvar, OnStartTimeChange);
	GetConVarString(hCvar, g_sStartTime, sizeof(g_sStartTime)));
Because i get these errors:
HTML Code:
(26) : error 035: argument type mismatch (argument 2)
(26) : error 001: expected token: ";", but found ")"
(26) : error 029: invalid expression, assumed zero
(26) : fatal error 190: too many error messages on one line
__________________
ADD ME ON STEAM - https://steamcommunity.com/id/kenoxyd
89.40.104.210:27015 // COMPETITIVE SERVER
DISCORD: KENOXYD#9098

Last edited by OXYD; 04-05-2020 at 10:07.
OXYD is offline
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 04-06-2020 , 04:57   Re: New Syntax Help
Reply With Quote #4

Quote:
Originally Posted by OXYD View Post
It worked, thanks
And one more question

If i have this:
HTML Code:
static const char g_sStartTime[ ][ ] = { "01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00","09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00", "00:00" }
How should i create this convar?

HTML Code:
	hCvar = CreateConVar("sm_ac_time_start", "23:00", "System start hour:");
	HookConVarChange(hCvar, OnStartTimeChange);
	GetConVarString(hCvar, g_sStartTime, sizeof(g_sStartTime)));
Because i get these errors:
HTML Code:
(26) : error 035: argument type mismatch (argument 2)
(26) : error 001: expected token: ";", but found ")"
(26) : error 029: invalid expression, assumed zero
(26) : fatal error 190: too many error messages on one line
You've defined g_sStartTime as constant so you can't store anything in it.
Use different char variable to store string in it.
Also you have one extra round bracket:
GetConVarString(hCvar, g_sStartTime, sizeof(g_sStartTime)));
__________________
MAGNAT2645 is offline
OXYD
AlliedModders Donor
Join Date: Aug 2019
Location: pluto
Old 04-06-2020 , 05:01   Re: New Syntax Help
Reply With Quote #5

Quote:
Originally Posted by MAGNAT2645 View Post
You've defined g_sStartTime as constant so you can't store anything in it.
Use different char variable to store string in it.
Also you have one extra round bracket:
GetConVarString(hCvar, g_sStartTime, sizeof(g_sStartTime)));
that i've putted by mystake when i've copyed the line.
The thing is, i dont want to store it, i want to take the values from g_sStartTime
__________________
ADD ME ON STEAM - https://steamcommunity.com/id/kenoxyd
89.40.104.210:27015 // COMPETITIVE SERVER
DISCORD: KENOXYD#9098
OXYD is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 04-06-2020 , 05:37   Re: New Syntax Help
Reply With Quote #6

It seems like all you want is to make sure sm_ac_time_start is between 0 and 23, which you can set in the convar:

PHP Code:
hCvar CreateConVar("sm_ac_time_start""23""System start hour:"0true0.0true23.0);
hCvar.AddChangeHook(OnStartTimeChange);

int iStartTime hCvar.IntValue
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 04-06-2020 , 09:38   Re: New Syntax Help
Reply With Quote #7

Quote:
Originally Posted by OXYD View Post
that i've putted by mystake when i've copyed the line.
The thing is, i dont want to store it, i want to take the values from g_sStartTime
Yes, but you're trying to get and store ConVar value to constant variable, you can't do that.
Here's GetConVarString from API.
__________________

Last edited by MAGNAT2645; 04-06-2020 at 09:39.
MAGNAT2645 is offline
OXYD
AlliedModders Donor
Join Date: Aug 2019
Location: pluto
Old 04-08-2020 , 14:03   Re: New Syntax Help
Reply With Quote #8

Kinda it worked, and kinda not. All im trying to do is finding a way that the plugin works after midnight. Each way i try, doesn't work. On day time everythings good, but after 00:00 its not workin anymore.
__________________
ADD ME ON STEAM - https://steamcommunity.com/id/kenoxyd
89.40.104.210:27015 // COMPETITIVE SERVER
DISCORD: KENOXYD#9098

Last edited by OXYD; 04-08-2020 at 14:04.
OXYD is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:39.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode