SA-MP Forums Archive
Block the command if... - 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: Block the command if... (/showthread.php?tid=144690)



Block the command if... - ArTisT - 28.04.2010

This command is respawning a ownable car (only if the car is not in use). I wan't it should send a message if someone is driving the car.. "You vehicle is in use try it later" anyone has idea ?

Quote:

if(strcmp(cmd, "/tc3", true) == 0 || strcmp(cmd, "/tv3", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new player=0; player<MAX_PLAYERS; player++)
{
if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
}
new keycar = PlayerInfo[playerid][pPcarkey3];
if(keycar != 255)
{
if(!unwanted[keycar]) SetVehicleToRespawn(keycar);
}
SendClientMessage(playerid, COLOR_WHITE, "Vehicle respawned");
}
return 1;
}




Re: Block the command if... - MadeMan - 28.04.2010

pawn Код:
if(strcmp(cmd, "/tc3", true) == 0 || strcmp(cmd, "/tv3", true) == 0)
  {
    if(IsPlayerConnected(playerid))
    {
     for(new player=0; player<MAX_PLAYERS; player++)
      {
        if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
      }
      new keycar = PlayerInfo[playerid][pPcarkey3];
      if(keycar != 255)
     {
      if(!unwanted[keycar]) SetVehicleToRespawn(keycar);
      else SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle is in use try it later");
     }
   }
   return 1;
  }



Re: Block the command if... - ArTisT - 28.04.2010

Thanks MadeMan it works and if player dont have a ownable car (pPcarkey3) it should block the cmd too and send a msg... "You dont' own a vehicle"


Re: Block the command if... - ArTisT - 28.04.2010

If he/she respawn the vehicle it should send a msg " You respawned your vehicle" and If he/she dont owns a vehicle it should send a msg "you dont have a vehicle". Please help

Quote:

if(strcmp(cmd, "/tc3", true) == 0 || strcmp(cmd, "/tv3", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new player=0; player<MAX_PLAYERS; player++)
{
if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
}
new keycar = PlayerInfo[playerid][pPcarkey3];
if(keycar != 255)
{
if(!unwanted[keycar]) SetVehicleToRespawn(keycar);
else SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle is in use try it later");
}
}
return 1;
}