Help with respawn vehicles -
sniperwars - 24.02.2012
Hi,
I'm currently helping a friend with his server and he wanted me to script the /respawncars command
so I this is what I have scripted:
pawn Code:
if(strcmp(cmdtext, "/respawncars", true) == 0)
{
if (IsPlayerAdmin(playerid))
{
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsVehicleOccupied(i) == 0)
{
SetVehicleToRespawn(i);
}
}
SendClientMessageToAll(COLOR_RED, "All vehicles has been respawned!");
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not RCON Admin");
}
return 1;
}
And I receive the following errors:
Code:
error 017: undefined symbol "IsVehicleOccupied"
I can't seem to fix this command. I've tried so many things and It still gives errors. Can anyone help me with this one ?
Re: Help with respawn vehicles -
dice7 - 24.02.2012
pawn Code:
new inVeh = 0;
for(new i = 0; i < MAX_VEHICLES; i++)
{
for (new j = 0; j < MAX_PLAYERS; j++)
{
if (IsPlayerInVehicle(j, i))
{
inVeh = 1;
break;
}
}
if (inVeh != 1)
{
SetVehicleToRespawn(i);
}
inVeh = 0;
}
SendClientMessageToAll(COLOR_RED, "All vehicles has been respawned!");
Re: Help with respawn vehicles -
sniperwars - 24.02.2012
Can you tell me where to place that in my script ?
Re: Help with respawn vehicles -
dice7 - 24.02.2012
pawn Code:
if(strcmp(cmdtext, "/respawncars", true) == 0)
{
if (IsPlayerAdmin(playerid))
{
new inVeh = 0;
for(new i = 0; i < MAX_VEHICLES; i++)
{
for (new j = 0; j < MAX_PLAYERS; j++)
{
if (IsPlayerInVehicle(j, i))
{
inVeh = 1;
break;
}
}
if (inVeh != 1)
{
SetVehicleToRespawn(i);
}
inVeh = 0;
}
SendClientMessageToAll(COLOR_RED, "All vehicles has been respawned!");
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not RCON Admin");
}
return 1;
}
Re: Help with respawn vehicles -
sniperwars - 24.02.2012
Thanks for the help guys. It works now.
This thread can be locked.
Re: Help with respawn vehicles -
sniperwars - 24.02.2012
Thanks for the help guys. It works now.
This thread can be locked.
Re: Help with respawn vehicles -
sniperwars - 24.02.2012
On second thoughts, this does not respawn the vehicles.
Re: Help with respawn vehicles -
Marco_Valentine - 24.02.2012
pawn Code:
if(strcmp(cmdtext, "/respawncars", true) == 0)
{
if (IsPlayerAdmin(playerid)){
new inVeh[MAX_VEHICLES];
for(new i = 0; i < MAX_VEHICLES; i++){
for (new j = 0; j < MAX_PLAYERS; j++){
if (IsPlayerInVehicle(j, i)){
inVeh[i] = GetPlayerVehicleID(j);
}
}
SetVehicleToRespawn(inVeh[i]);
}
SendClientMessageToAll(COLOR_RED, "All vehicles has been respawned!");
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not RCON Admin");
}
return 1;
}
Please +Rep me