Re-spawn - 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)
+--- Thread: Re-spawn (
/showthread.php?tid=596827)
Re-spawn -
aysam7 - 23.12.2015
hello !!
brother , I have command to re-spawn all cars , but when I add it to pwn I get error
Код:
:C:\Users\Admin\Desktop\COD\COD.pwn(24535) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\COD\COD.pwn(24537) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\COD\COD.pwn(24539) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\COD\COD.pwn(24542) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\COD\COD.pwn(24544) : error 017: undefined symbol "CAR_AMOUNT"
C:\Users\Admin\Desktop\COD\COD.pwn(24545) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\COD\COD.pwn(24547) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\COD\COD.pwn(24549) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\COD\COD.pwn(24551) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\COD\COD.pwn(24556) : error 054: unmatched closing brace ("}")
C:\Users\Admin\Desktop\COD\COD.pwn(24557) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\COD\COD.pwn(24560) : warning 203: symbol is never used: "unwanted"
11 Errors.
and this is code :
Код:
if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0) // by Ellis
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 3)
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
return 1;
}
new bool:unwanted[CAR_AMOUNT];
for(new player=0; player<MAX_PLAYERS; player++)
{
if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
}
for(new car = 1; car <= 268; car++)
{
if(!unwanted[car]) SetVehicleToRespawn(car);
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "SERVER: All unused cars respawned by %s.", sendername);
BroadCast(COLOR_WHITE,string);
}
return 1;
}
Re: Re-spawn -
SpikY_ - 23.12.2015
the codes up looks some messy,
try this:
PHP код:
forward VehicleOccupied(vehicleid);
CMD:respawncars(playerid, params[])
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string,sizeof(string),"{FF0000}» Admin: %s has respawned all un-occupieded vehicles.", sendername);
SendClientMessageToAll(-1, string);
GameTextForAll("~n~~n~~n~~n~~n~~n~~r~Vehicles ~g~Respawned", 3000,3);
for(new cars=0; cars<MAX_VEHICLES; cars++)
{
if(!VehicleOccupied(cars))
{
SetVehicleToRespawn(cars);
}
}
return 1;
}
public VehicleOccupied(vehicleid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInVehicle(i,vehicleid)) return 1;
}
return 0;
}
Re: Re-spawn -
aysam7 - 23.12.2015
okay , but where is if(PlayerInfo[playerid][pAdmin] < 3)
I need it
Re: Re-spawn -
Sh4d0w2 - 23.12.2015
PHP код:
forward VehicleOccupied(vehicleid);
CMD:respawncars(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,0xE60000FF,"You're not allowed to use this command !");
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string,sizeof(string),"{FF0000}» Admin: %s has respawned all un-occupieded vehicles.", sendername);
SendClientMessageToAll(-1, string);
GameTextForAll("~n~~n~~n~~n~~n~~n~~r~Vehicles ~g~Respawned", 3000,3);
}
for(new cars=0; cars<MAX_VEHICLES; cars++)
{
if(!VehicleOccupied(cars))
{
SetVehicleToRespawn(cars);
}
}
return 1;
}
public VehicleOccupied(vehicleid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInVehicle(i,vehicleid)) return 1;
}
return 0;
}
Re: Re-spawn -
aysam7 - 23.12.2015
ok , no warnings , no errors
i'll see
thank you