/v command help
#4

Make a global variable for those vehicle the player has created:
pawn Код:
new TmpVehicle[MAX_PLAYERS];
pawn Код:
...
if(strcmp(cmd, "/v", true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] < 2) return DenyMessage(playerid, 2);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /v [carid] [color] [color]");
    new car;
    car = strval(tmp);
    if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_WHITE, "Vehicle Model can't be below 400 or above 611 !"); return 1; }
    tmp = strtok(cmdtext, idx);
    new color1;
    color1 = strval(tmp);
    if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COLOR_WHITE, "Color Number can't be below 0 or above 126 !"); return 1; }
    tmp = strtok(cmdtext, idx);
    new color2;
    color2 = strval(tmp);
    if(color2 < 0 || color2 > 126) return SendClientMessage(playerid, COLOR_WHITE, "Color Number can't be below 0 or above 126 !");
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid, X,Y,Z);
    TmpVehicle[playerid] = CreateVehicle(car, X,Y+2,Z, 0.0, color1, color2, 1500000);
    SetVehicleVirtualWorld(TmpVehicle[playerid], GetPlayerVirtualWorld(playerid));
    LinkVehicleToInterior(TmpVehicle[playerid], GetPlayerInterior(playerid));
    return 1;
 }
...
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
  for(new i = 0; i < MAX_PLAYERS; i ++)
  {
    if(TmpVehicle[i] == vehicleid && vehicleid != INVALID_VEHICLE_ID)
    {
      DestroyVehicle(TmpVehicle[i]);
      TmpVehicle[i] = INVALID_VEHICLE_ID;
    }
  }
  return 1;
}
Reply


Messages In This Thread
/v command help - by cssbart - 11.03.2010, 17:50
Re: /v command help - by StreetGT - 11.03.2010, 17:56
Re: /v command help - by cssbart - 11.03.2010, 17:57
Re: /v command help - by Miguel - 11.03.2010, 18:28
Re: /v command help - by cssbart - 11.03.2010, 18:38
Re: /v command help - by Correlli - 11.03.2010, 18:41
Re: /v command help - by Miguel - 11.03.2010, 18:52
Re: /v command help - by cssbart - 11.03.2010, 19:13
Re: /v command help - by Miguel - 11.03.2010, 19:19
Re: /v command help - by cssbart - 11.03.2010, 19:20
Re: /v command help - by Miguel - 11.03.2010, 19:22
Re: /v command help - by cssbart - 12.03.2010, 16:09

Forum Jump:


Users browsing this thread: 1 Guest(s)