SA-MP Forums Archive
[Solved]1 error in my command - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Solved]1 error in my command (/showthread.php?tid=144856)



[Solved]1 error in my command - ArTisT - 29.04.2010

There problem is if i put "GivePlayerMoney(playerid, -8000);" it gives the error. Error name is error 029: invalid expression, assumed zero. Anyone has a idea how to fix it ?

Quote:

if(strcmp(cmd, "/t2", true) == 0 || strcmp(cmd, "/tv2", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new player=0; player<MAX_PLAYERS; player++)
{
if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
}
new keyr = PlayerInfo[playerid][pky2];
if(keyr != 999)
{
if(!unwanted[keycar]) SetVehicleToRespawn(keyr);
GivePlayerMoney(playerid, -8000); // gives the error
else SendClientMessage(playerid, COLOR_WHITE, "* vehicle is in use");
}
}
return 1;
}




Re: [HELP]1 error in my command - Correlli - 29.04.2010

Because you've putted it between if and else statement, and you can't do that.


Re: [HELP]1 error in my command - ArTisT - 29.04.2010

where i need to put it ? Pls help. Thanks.


Re: [HELP]1 error in my command - Correlli - 29.04.2010

I don't know, you decide where do you want to use it, under if or under else statement.


Re: [HELP]1 error in my command - ArTisT - 29.04.2010

Quote:
Originally Posted by Don Correlli
I don't know, you decide where do you want to use it, under if or under else statement.
under if.. if the car respawns money should go. ty for help


Re: [HELP]1 error in my command - ArTisT - 29.04.2010

I tried some ways pawno is crashing.. Can somone give a correct code pls ?


Re: [HELP]1 error in my command - Correlli - 29.04.2010

pawn Код:
if(strcmp(cmd, "/t2", true) == 0 || strcmp(cmd, "/tv2", true) == 0)
{
  for(new player = 0; player < GetMaxPlayers(); player++)
  {
    if(IsPlayerInAnyVehicle(player)) unwanted[GetPlayerVehicleID(player)] = true;
  }
  new
      keyr = PlayerInfo[playerid][pky2];
  if(keyr != 999)
  {
    if(!unwanted[keycar])
    {
      SetVehicleToRespawn(keyr);
      GivePlayerMoney(playerid, -8000);
    }
    else SendClientMessage(playerid, COLOR_WHITE, "* vehicle is in use");
  }
  return true;
}



Re: [Solved]1 error in my command - ArTisT - 29.04.2010

Thanks Don Correlli it works