Problem playerid - 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: Problem playerid (
/showthread.php?tid=269433)
Problem playerid -
RatHack - 16.07.2011
Hello, this public timer doesn't give me any warning or error.
Just that text appear for all people on server.
pawn Code:
Fuel = SetTimer("FuelTimer",50000,false);
pawn Code:
public FuelTimer()
{
for(new i, g_m = GetMaxPlayers(); i < g_m; i++) if(IsPlayerConnected(i))
{
SetVehicleHealth(mycar7, 150.0);
GameTextForPlayer(i,"CAR WITHOUT FUEL", 5000, 3);
SendClientMessage(i,COLOR_LIGHTBLUE,"NO FUEL FOR THIS CAR");
}
return 1;
}
How to make it only for the player?
Re: Problem playerid -
Lorenc_ - 16.07.2011
You need a statement to check whether the person is in a vehicle with low fuel, else it wouldn't work out.
Respuesta: Problem playerid -
RatHack - 16.07.2011
How to make that? please
Re: Problem playerid -
Lorenc_ - 16.07.2011
pawn Code:
new vID = GetPlayerVehicleID(playerid);
new gVehicleFuel[MAX_VEHICLES] = 100;
public FuelTimer()
{
for(new i, g_m = GetMaxPlayers(); i < g_m; i++) if(IsPlayerConnected(i))
{
if(gVehicleFuel[vID] <= 0) {
SetVehicleHealth(mycar7, 150.0);
GameTextForPlayer(i,"CAR WITHOUT FUEL", 5000, 3);
SendClientMessage(i,COLOR_LIGHTBLUE,"NO FUEL FOR THIS CAR");
}
}
return 1;
}
Example: Wouldn't work though!
Respuesta: Problem playerid -
RatHack - 16.07.2011
Crash