SA-MP Forums Archive
Invalid expression assumed zero - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Invalid expression assumed zero (/showthread.php?tid=496116)



Invalid expression assumed zero - trukker1998 - 20.02.2014

Hi, I try to make an killerstreak.. but i still get an error..

My pawn code:
Код:
new name1[MAX_PLAYER_NAME+1] = GetPlayerName(killerid, name1, sizeof(name1));
switch(killstreak[killerid])
     {
		  case 1:
		  {
			   SendClientMessage(killerid, -1,"Your now on Killstreak of 1!");
          }
          case 5:
          {
               SendClientMessage(killerid, -1,"Your now on Killstreak of 5!!");
               forward(string, sizeof(string), "NEW KILLER %s has killed 5 suspects!, stop him and KILL him!", name1);
               SendClientMessageToAll(COLOR_RED, string);
          }
          case 10:
          {
               SendClientMessage(killerid, -1,"Your now on Killstreak of 10!!");
               forward(string, sizeof(string), "POWER KILLER %s has killed 10 suspects!, stop him and KILL him!", name1);
               SendClientMessageToAll(COLOR_RED, string);
          }
          case 15:
          {
               SendClientMessage(killerid, -1,"Your now on Killstreak of 15!!");
               forward(string, sizeof(string), "HARDCORE KILLER %s has killed 15 suspects!, stop him and KILL him!", name1);
               SendClientMessageToAll(COLOR_RED, string);
          }
          case 20:
          {
               SendClientMessage(killerid, -1,"Your now on Killstreak of 20!!");
               forward(string, sizeof(string), "MONSTER KILLER %s has killed 20 suspects!, stop him and KILL him!", name1);
               SendClientMessageToAll(COLOR_RED, string);
          }
          case 30:
          {
               SendClientMessage(killerid, -1,"Your now on Killstreak of  30!!");
               forward(string, sizeof(string), "UBER KILLER %s has killed 30 suspects!, stop him and KILL him!", name1);
               SendClientMessageToAll(COLOR_RED, string);
          }
          case 50:
          {
               SendClientMessage(killerid, -1,"Your now on Killstreak of  50!!");
               forward(string, sizeof(string), "ULTIMATE MASTER KILLER %s has killed 50 suspects!, stop him and KILL him!", name1);
               SendClientMessageToAll(COLOR_RED, string);
          }
     }
The error:

The problem comes from the forward lines.


Re: Invalid expression assumed zero - ACI - 20.02.2014

Try this:
pawn Код:
new name1[MAX_PLAYER_NAME+1];
GetPlayerName(killerid, name1, sizeof(name1));
Anyway, what OS do you have there?


Re: Invalid expression assumed zero - Konstantinos - 20.02.2014

Change every single line of:
pawn Код:
forward(string, sizeof(string)
to:
pawn Код:
format(string, sizeof(string)
and also change:
pawn Код:
new name1[MAX_PLAYER_NAME+1] = GetPlayerName(killerid, name1, sizeof(name1));
to:
pawn Код:
new name1[MAX_PLAYER_NAME];
GetPlayerName(killerid, name1, sizeof(name1));



Re: Invalid expression assumed zero - trukker1998 - 20.02.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Change every single line of:
pawn Код:
forward(string, sizeof(string)
to:
pawn Код:
format(string, sizeof(string)
and also change:
pawn Код:
new name1[MAX_PLAYER_NAME+1] = GetPlayerName(killerid, name1, sizeof(name1));
to:
pawn Код:
new name1[MAX_PLAYER_NAME];
GetPlayerName(killerid, name1, sizeof(name1));
Thanks it worked #rep


Re: Invalid expression assumed zero - trukker1998 - 20.02.2014

Quote:
Originally Posted by ACI
Посмотреть сообщение
Try this:
pawn Код:
new name1[MAX_PLAYER_NAME+1];
GetPlayerName(killerid, name1, sizeof(name1));
Anyway, what OS do you have there?
I bougt an old school computer, upgrated the HD and RAM and installed Windows Server 2008 R1 Standard .
So what you see is my tiny Development Server.