08.01.2011, 02:57
Hello guys, i'm looking for command /veh wich spawns car with IDs for RP servers, when i respawn all cars the /veh i spawned does respawn at the location, i hope you all understood what i mean.
new Vehicles[MAX_VEHICLES];
new VehicleAmount;
public OnPlayerCommandText(playerid,cmdtext[])
{
if(!strcmp(cmdtext,"/veh",true))
{
if(!IsPlayerAdmin(playerid))return 0;
new tmp;
new spaces[4];
for(new cell;cell<strlen(cmdtext);cell++)if(cmdtext[cell]=' ')
{
space[tmp]=cell+1;
tmp++;
}
if(tmp<4)return SendClientMessage(playerid,0xFF0000FF,"USAGE: /Veh [Model] [Color1] [Color2] [RespawnTime]");
for(new error;error<4;error++)if(!space[error])return SendClientMessage(playerid,0xFF0000FF,"USAGE: /Veh [Model] [Color1] [Color2] [RespawnTime]");
new Float:x,Float:y,Float:z,Float:a;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,a);
Vehicles[VehicleAmount] = CreateVehicle(strval(space[0]),x,y,z,a,strval(space[1]),strval(space[2]),strval(space[3]));
VehicleAmount++;
return SendClientMessage(playerid,0xAAAAAAFF,"Vehicle Created.");
}
if(!strcmp(cmdtext,"/RespawnCars",true))
{
if(!IsPlayerAdmin(playerid))return 0;
for(new vehicle;vehicle<MAX_VEHICLES;vehicle++)SetVehicleToRespawn(Vehicles[vehicle]);
return SendClientMessage(playerid,0xAAAAAAFF,"All Vehicles Respawned.");
}
return 0;
}
C:\Documents and Settings\wesso\Desktop\0.3c SAMP Server\0.2X\gamemodes\SAGC.pwn(7321) : warning 217: loose indentation C:\Documents and Settings\wesso\Desktop\0.3c SAMP Server\0.2X\gamemodes\SAGC.pwn(7322) : error 029: invalid expression, assumed zero C:\Documents and Settings\wesso\Desktop\0.3c SAMP Server\0.2X\gamemodes\SAGC.pwn(7322) : error 029: invalid expression, assumed zero C:\Documents and Settings\wesso\Desktop\0.3c SAMP Server\0.2X\gamemodes\SAGC.pwn(7327) : warning 219: local variable "tmp" shadows a variable at a preceding level C:\Documents and Settings\wesso\Desktop\0.3c SAMP Server\0.2X\gamemodes\SAGC.pwn(7329) : warning 211: possibly unintended assignment C:\Documents and Settings\wesso\Desktop\0.3c SAMP Server\0.2X\gamemodes\SAGC.pwn(7331) : error 017: undefined symbol "space" C:\Documents and Settings\wesso\Desktop\0.3c SAMP Server\0.2X\gamemodes\SAGC.pwn(7331) : warning 215: expression has no effect C:\Documents and Settings\wesso\Desktop\0.3c SAMP Server\0.2X\gamemodes\SAGC.pwn(7331) : error 001: expected token: ";", but found "]" C:\Documents and Settings\wesso\Desktop\0.3c SAMP Server\0.2X\gamemodes\SAGC.pwn(7331) : error 029: invalid expression, assumed zero C:\Documents and Settings\wesso\Desktop\0.3c SAMP Server\0.2X\gamemodes\SAGC.pwn(7331) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 6 Errors.
1. Open Pawno > Files > New.
2. Find public OnPlayerCommandText.
3. Replace codes.