Votekick error !?!?
#1

OK I did this
Код:
CMD:votekick(playerid, params[])
{
    if(pInfo[playerid][Helper] >= 1)
    {
        if(VoteOn) return SendClientMessage(playerid, 0xCC0000AA, "There's already a vote going on!");
        new Target, reason[64];
        if(sscanf(params, "rS(None)[64]", Target, reason)) return SendClientMessage(playerid, 0xCC0000AA, "USAGE: /votekick <playerid> <raason(optional)>");

        VoteOn = true;
        VoteAgainst = Target;
        format(VoteReason, sizeof(VoteReason), "%s", reason);
        VoteTimer = SetTimer("VoteEnd", 60000, false);
        new string[128];
        format(string, sizeof(string), "*"COL_WHITE"* %s votekick has started against%s for %s",Name(Target), VoteReason);
        SendClientMessageToAll(COLOR_LIGHTBLUE, string);
    }
    else return SendClientMessage(playerid, COLOR_RED,"You have to be level 1 to use that command!");
    return 1;
}
The errors show on this line
Код:
 format(string, sizeof(string), "*"COL_WHITE"* %s has banned %s for %s",Name(Target), VoteReason);
ERROR :
Код:
error 001: expected token: "-string end-", but found "-identifier-"
So either im blind and I'm missing something , either im drunk..
Reply
#2

Hm.... I copied that line into my gamemode, and it compiled fine (once i switched out the arrays to existing ones in my script).

Btw, you have three '%s' but only two arrays assigned.
I stared on it for 5 minutes and can't figure it out either :S

Unless "rS(None)[64]" in the sscanf ' (None)' ? has something to do with it..

Oh. We have almost the exact script style (atleast when it comes to commands)
Reply
#3

If you want to use quotation marks in your strings you'll need to escape them - https://sampwiki.blast.hk/wiki/Escape_codes

If you're trying to use colors in your string, you'll need to embed them, if you want the whole message to be one color, you'd do that with SendClientMessage/SendClientMessageToAll - https://sampwiki.blast.hk/wiki/Colour_Em...olor_embedding
Reply
#4

Quote:
Originally Posted by rymax99
Посмотреть сообщение
If you want to use quotation marks in your strings you'll need to escape them - https://sampwiki.blast.hk/wiki/Escape_codes

If you're trying to use colors in your string, you'll need to embed them, if you want the whole message to be one color, you'd do that with SendClientMessage/SendClientMessageToAll - https://sampwiki.blast.hk/wiki/Colour_Em...olor_embedding
Thanks but it didn't work either there must be something that I'm missing
Reply
#5

Anybody else can help me ?
Reply
#6

format(string, sizeof(string), "*{FFFFFF}* %s has banned for %s",Name(Target), VoteReason);
Reply
#7

Quote:
Originally Posted by Naruto_Emilio
Посмотреть сообщение
format(string, sizeof(string), "*{FFFFFF}* %s has banned for %s",Name(Target), VoteReason);
Thanks but...
Код:
C:\Users\PC\Desktop\ALL FILES\dayzsa\DayZ\gamemodes\dayz_4.1.pwn(15606) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\PC\Desktop\ALL FILES\dayzsa\DayZ\gamemodes\dayz_4.1.pwn(15606) : warning 215: expression has no effect
C:\Users\PC\Desktop\ALL FILES\dayzsa\DayZ\gamemodes\dayz_4.1.pwn(15606) : warning 215: expression has no effect
C:\Users\PC\Desktop\ALL FILES\dayzsa\DayZ\gamemodes\dayz_4.1.pwn(15606) : error 001: expected token: ";", but found ")"
C:\Users\PC\Desktop\ALL FILES\dayzsa\DayZ\gamemodes\dayz_4.1.pwn(15606) : error 029: invalid expression, assumed zero
C:\Users\PC\Desktop\ALL FILES\dayzsa\DayZ\gamemodes\dayz_4.1.pwn(15606) : fatal error 107: too many error messages on one line
Still shows the errors :S
Reply
#8

PHP код:
CMD:votekick(playeridparams[])
{
    if(
pInfo[playerid][Helper] >= 1)
    {
        if(
VoteOn) return SendClientMessage(playerid0xCC0000AA"There's already a vote going on!");
        new 
Targetreason[64];
        if(
sscanf(params"rS(None)[64]"Targetreason)) return SendClientMessage(playerid0xCC0000AA"USAGE: /votekick <playerid> <raason(optional)>");
        
VoteOn true;
        
VoteAgainst Target;
        
format(VoteReasonsizeof(VoteReason), "%s"reason);
        
VoteTimer SetTimer("VoteEnd"60000false);
        new 
string[128];
        
format(stringsizeof(string), "*"COL_WHITE"* %s votekick has started against%s for %s",Name(playerid),Name(Target), VoteReason);
        
SendClientMessageToAll(COLOR_LIGHTBLUEstring);
    }
    else return 
SendClientMessage(playeridCOLOR_RED,"You have to be level 1 to use that command!");
    return 
1;

PHP код:
format(stringsizeof(string), "*"COL_WHITE"* %s has banned %s for %s",Nam(playerid),Name(Target), VoteReason); 
Here you go, tell me if the problem persists.
Reply
#9

Quote:
Originally Posted by youssefehab500
Посмотреть сообщение
PHP код:
CMD:votekick(playeridparams[])
{
    if(
pInfo[playerid][Helper] >= 1)
    {
        if(
VoteOn) return SendClientMessage(playerid0xCC0000AA"There's already a vote going on!");
        new 
Targetreason[64];
        if(
sscanf(params"rS(None)[64]"Targetreason)) return SendClientMessage(playerid0xCC0000AA"USAGE: /votekick <playerid> <raason(optional)>");
        
VoteOn true;
        
VoteAgainst Target;
        
format(VoteReasonsizeof(VoteReason), "%s"reason);
        
VoteTimer SetTimer("VoteEnd"60000false);
        new 
string[128];
        
format(stringsizeof(string), "*"COL_WHITE"* %s votekick has started against%s for %s",Name(playerid),Name(Target), VoteReason);
        
SendClientMessageToAll(COLOR_LIGHTBLUEstring);
    }
    else return 
SendClientMessage(playeridCOLOR_RED,"You have to be level 1 to use that command!");
    return 
1;

PHP код:
format(stringsizeof(string), "*"COL_WHITE"* %s has banned %s for %s",Nam(playerid),Name(Target), VoteReason); 
Here you go, tell me if the problem persists.
Yes it does lol now it shows this twice
error 001: expected token: "-string end-", but found "-identifier-"
Reply
#10

Quote:
Originally Posted by Wizzard2H
Посмотреть сообщение
Yes it does lol now it shows this twice
error 001: expected token: "-string end-", but found "-identifier-"
I'm actually suspecting the *"COL_WHITE"*.
PHP код:
format(stringsizeof(string), "*"COL_WHITE"* %s has banned %s for %s",Nam(playerid),Name(Target), VoteReason); 
To
PHP код:
format(stringsizeof(string), ""COL_WHITE" %s has banned %s for %s",Nam(playerid),Name(Target), VoteReason); 
I know it isn't the problem just try it, you won't lose a thing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)