SA-MP Forums Archive
one error - 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: one error (/showthread.php?tid=109129)



one error - [HKS]dlegend - 17.11.2009

this is wat i made for personal car and for personal gang cars

but it wont compile
1566) : error 035: argument type mismatch (argument 4)

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  new string[100];
  new PlayerName1[24];
  GetPlayerName(playerid, PlayerName1, sizeof(PlayerName1));
  GetPlayerName(playerid, string, MAX_PLAYER_NAME);
  if(newstate == PLAYER_STATE_DRIVER)
  {
   new Vehicle = GetPlayerVehicleID(playerid);
   if(Vehicle == dlegend)
   {
     if(strcmp(PlayerName1,"dlegend",true))
     {
      RemovePlayerFromVehicle(playerid);
      SendClientMessage(playerid, 0xFB0000FF, "I'm sorry, but this car has been reserved for dlegend");
     }
   }
  }
  if(newstate == PLAYER_STATE_DRIVER)
  {
   new Vehicle = GetPlayerVehicleID(playerid);
   if(Vehicle == dlegend)
   {
1566     if(strcmp(PlayerName1,"[pTc]%d",true,string))
     {
      RemovePlayerFromVehicle(playerid);
      SendClientMessage(playerid, 0xFB0000FF, "I'm sorry, but this car has been reserved for ptc members");
     }
   }
  }
  return 1;
}}



Re: one error - Hiitch - 17.11.2009

Which line is 1566?


Re: one error - Peter_Corneile - 17.11.2009

Quote:

1566 if(strcmp(PlayerName1,"[pTc]%d",true,string))




Re: one error - Hiitch - 17.11.2009

My thoughts on that are that;

%d is assigned to true.

so just remove the ,string.

and if you're checking for if the player is not that name then,

instead of
pawn Код:
if(strcmp(PlayerName1,"dlegend",true))
you need to do
pawn Код:
if(!strcmp(PlayerName1,"dlegend",true))
note how the ' ! ' is for checking if the persons name is not dlegend.



Re: one error - [HKS]dlegend - 17.11.2009

but wat i need it to do is have the ptc in there name then the players name so i though it would have to be like that


Re: one error - Peter_Corneile - 17.11.2009

Why dont you use format ?


Re: one error - Kyosaur - 17.11.2009

Quote:
Originally Posted by [NaB
Hiitch - No srsly, Im a NaB ! ]
My thoughts on that are that;

%d is assigned to true.

so just remove the ,string.

and if you're checking for if the player is not that name then,

instead of
pawn Код:
if(strcmp(PlayerName1,"dlegend",true))
you need to do
pawn Код:
if(!strcmp(PlayerName1,"dlegend",true))
note how the ' ! ' is for checking if the persons name is not dlegend.
The ! is to check if they ARE the same. Strcmp returns 0 if the strings you are comparing match.