killstreak compile problems
#1

Код:
Kills[killerid] ++;
new string1[128], string2[128],string3[128], pname[MAX_PLAYER_NAME], kname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
GetPlayerName(killerid, kname, sizeof(kname));
if(IsPlayerConnected(playerid))
{
if(Kills[playerid] > 0)
{
format(string1, sizeof(string1), ""{COL_RED}"* {%06x}%s(%d) "{COL_RED}"ended %s(%d) killstreak of %d kills!",GetPlayerColor(killerid) >>> 8, kname, killerid, pname, playerid, Kills[playerid]);
SendClientMessageToAll(COLOR_RED, string1);
}
if(Kills[killerid] = 3)
{
format(string2, sizeof(string2)), ""{COL_RED}"* {%06x}%s(%d) "{COL_RED}"is on a killstreak with 3 kills!",GetPlayerColor(killerid) >>> 8, kname, killerid);
SendClientMessageToAll(COLOR_RED, string2);
}
if(Kills[killerid] = 5)
{
format(string3, sizeof(string3)), ""{COL_RED}"* {%06x}%s(%d) "{COL_RED}"is on a killstreak with 5 kills!",GetPlayerColor(killerid) >>> 8, kname, killerid);
SendClientMessageToAll(COLOR_RED, string3);
}
}
I've made this code OnPlayerDeath and I got these errors:

Код:
(1740) : error 001: expected token: "-string end-", but found "-identifier-"
(1740) : warning 215: expression has no effect
(1740) : error 001: expected token: ";", but found "}"
(1740) : error 029: invalid expression, assumed zero
(1740) : fatal error 107: too many error messages on one line
I guess something is wrong with the string formatting..

If someone can help me it will be great, Thanks
Reply
#2

change
pawn Код:
format(string2, sizeof(string2))
format(string3, sizeof(string3))
to
pawn Код:
format(string2, sizeof(string2)
format(string3, sizeof(string3)
Reply
#3

Quote:
Originally Posted by RedFusion
Посмотреть сообщение
change
pawn Код:
format(string2, sizeof(string2))
format(string3, sizeof(string3))
to
pawn Код:
format(string2, sizeof(string2)
format(string3, sizeof(string3)
I've done it, and it's still showing me errors on the first string..

Код:
(1741) : error 001: expected token: "-string end-", but found "-identifier-"
(1741) : warning 215: expression has no effect
(1741) : error 001: expected token: ";", but found "}"
(1741) : error 029: invalid expression, assumed zero
(1741) : fatal error 107: too many error messages on one line
line 1741:
Код:
format(string1, sizeof(string1), ""{COL_RED}"* {%06x}%s(%d) "{COL_RED}"ended %s(%d) killstreak of %d kills!",GetPlayerColor(killerid) >>> 8, kname, killerid, pname, playerid, Kills[playerid]);
Reply
#4

COL_RED is not defined as a string but an integer.

You can use it as:
pawn Код:
#define COL_RED "{FF0000}"

...

format(string1, sizeof(string1), "* {%06x}%s(%d) " COL_RED "ended %s(%d) killstreak of %d kills!", GetPlayerColor(killerid) >>> 8, kname, killerid, pname, playerid, Kills[playerid]);
Reply
#5

At the top of your script add:
PHP код:
#define COL_RED "{FF0000}" 
then use COL_RED instead of "COL_RED".

Refer to Konstantinos answer above for an better explanation.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)