Respawncars - 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: Respawncars (
/showthread.php?tid=305018)
Respawncars -
Oh - 20.12.2011
I was wondering if someone can help me make it so it doesn't respawn cars if someones in them, and when I respawn cars it takes my bot out for some odd reason.
+rep intended
pawn Код:
if(strcmp(cmd, "/respawncars", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
for(new i = 0; i < MAX_VEHICLES; i++)
{
SetVehicleToRespawn(i);
}
SendClientMessageToAll(BLANCO, "Server: Vehicles respawned");
printf("Vehicle respawn");
for(new i = 0;i < MAX_PLAYERS; i++)
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(i, npcname, sizeof(npcname));
if(!strcmp(npcname,"Bot_Intro",true))
{
PutPlayerInVehicle(i,50, 0);
SetVehicleParamsEx(i, 1, 0, -1, 0, 0, 0, 0);
TogglePlayerControllable(i, true);
SetPlayerColor(i, BLANCO2);
gTeam[i] = EHUMANO;
}
}
for(new i = 0; i < MAX_VEHICLES; i++)
{
SetVehicleParamsEx(i, 0, 0, 0, 0, 0, 0, 0);
}
}
else
{
SendClientMessage(playerid, ROJO_OSCURO, " You dont got permission for this command");
return 1;
}
}
return 1;
}
Re: Respawncars -
[HiC]TheKiller - 21.12.2011
pawn Код:
if(strcmp(cmd, "/respawncars", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
new IsVehicleOccupied[MAX_VEHICLES];
for(new x = 0; x<MAX_PLAYERS; x++)
{
new vehid = GetPlayerVehicleID(x);
if(vehid != 0) IsVehicleOccupied[vehid] ++;
}
for(new i = 0; i < MAX_VEHICLES; i++)
{
if(!IsVehicleOccupied[i]) SetVehicleToRespawn(i);
}
SendClientMessageToAll(BLANCO, "Server: Vehicles respawned");
printf("Vehicle respawn");
for(new i = 0;i < MAX_PLAYERS; i++)
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(i, npcname, sizeof(npcname));
if(!strcmp(npcname,"Bot_Intro",true))
{
PutPlayerInVehicle(i,50, 0);
SetVehicleParamsEx(i, 1, 0, -1, 0, 0, 0, 0);
TogglePlayerControllable(i, true);
SetPlayerColor(i, BLANCO2);
gTeam[i] = EHUMANO;
}
}
for(new i = 0; i < MAX_VEHICLES; i++)
{
SetVehicleParamsEx(i, 0, 0, 0, 0, 0, 0, 0);
}
}
else
{
SendClientMessage(playerid, ROJO_OSCURO, " You dont got permission for this command");
return 1;
}
}
return 1;
}
Could just do that.