/ftow problem - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /ftow problem (
/showthread.php?tid=160999)
/ftow problem -
Mystique - 18.07.2010
So, today I started to figure out a /ftow command. However, the cars that should respawn doesn't do it.
Код:
if(strcmp(cmd, "/ftow", true) ==0)
{
if(PlayerInfo[playerid][LoggedIn] == 1)
{
if(PlayerInfo[playerid][Faction] == 1)
{
if(PlayerInfo[playerid][Rank] >= 4)
{
for(new i = 0;i<MAX_CARS;i++)
{
if(CarSystem[i][Carowner] == PlayerInfo[playerid][Faction])
{
SetVehicleToRespawn(i);
SendClientMessage(playerid, COLOR_WHITE, "You have successfully faction towed your faction vehicles");
return 1;
}
}
}
else return SendClientMessage(playerid, COLOR_RED, "You need to be aleast rank 4 to faction tow.");
}
else return SendClientMessage(playerid, COLOR_RED, "You are not in a faction.");
}
else return SendClientMessage(playerid, COLOR_RED, "You need to be logged in to perform this command.");
return 1;
}
Re: /ftow problem -
Agent Smith - 18.07.2010
You want to use
https://sampwiki.blast.hk/wiki/GetPlayerVehicleID, you don't want to check all the vehicles to see which one you are in.
Re: /ftow problem -
Mystique - 18.07.2010
I thought GetPlayerVehicleID was made to check the ID of the vehicle you sit in.
Re: /ftow problem -
Agent Smith - 18.07.2010
Well you get get the vehicle ID and then use it in SetVehicleToRespawn
For example:
pawn Код:
if(strcmp(cmd, "/respawnthiscar", true) == 0 || strcmp(cmd, "/rtc", true) == 0) // by Ellis
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 2 )
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
return 1;
}
if(IsPlayerInAnyVehicle(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "AdmWarning: %s has just respawned vehicle id %d.",sendername,GetPlayerVehicleID(playerid));
ABroadCast(COLOR_YELLOW,string,1);
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY, " Vehicle Respawned !");
}
}
return 1;
}
EIDT: I know it is out of LARP but this is just to show an example.
Re: /ftow problem -
Mystique - 18.07.2010
You seem to not understand the idea. The /ftow is mean't to respawn all of the vehicles that belongs to faction 1. Which means you can't use GetPlayervehicleID. It's about 8 vehicles.
Re: /ftow problem -
Agent Smith - 18.07.2010
Ohhh.. Then I don't know what is wrong. It looks right.
Re: /ftow problem -
Mystique - 19.07.2010
Bumping, does anyone know?
Re: /ftow problem -
Mystique - 21.07.2010
Bump once again...
Re: /ftow problem -
Limex - 23.07.2010
pawn Код:
if(strcmp(cmd, "/ftow", true) ==0)
{
if(PlayerInfo[playerid][LoggedIn] == 1)
{
if(PlayerInfo[playerid][Faction] == 1)
{
if(PlayerInfo[playerid][Rank] >= 4)
{
for(new i = 0;i<MAX_CARS;i++)
{
if(CarSystem[i][Carowner] == PlayerInfo[playerid][Faction])
{
SetVehicleToRespawn(i+1);
}
}
SendClientMessage(playerid, COLOR_WHITE, "You have successfully faction towed your faction vehicles");
}
else return SendClientMessage(playerid, COLOR_RED, "You need to be aleast rank 4 to faction tow.");
}
else return SendClientMessage(playerid, COLOR_RED, "You are not in a faction.");
}
else return SendClientMessage(playerid, COLOR_RED, "You need to be logged in to perform this command.");
return 1;
}
Try this.