What will be the outcome? - 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: What will be the outcome? (
/showthread.php?tid=73136)
What will be the outcome? -
Lewwy - 12.04.2009
If I do this specific loop:
pawn Code:
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerInVehicle(i, IsATaxi(GetPlayerVehicleID(i))) && newstate == PLAYER_STATE_DRIVER)
{
return GivePlayerCash(i, 20);
}
}
My IsATaxi function:
pawn Code:
public IsATaxi(vehicleid)
{
new model = GetVehicleModel(vehicleid);
if(model == 420)
{
return 1;
}
return 0;
}
Will this give every driver that is currently in a taxi $20 or just the one the passenger enters.
Whole section of desired code:
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_PASSENGER)
{
if(PlayerInfo[playerid][pCalledTaxi] == 1 && IsATaxi(GetPlayerVehicleID(playerid)))
{
GivePlayerCash(playerid, -20);
PlayerInfo[playerid][pCalledTaxi] = 0;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You entered the taxi which you called for, this ride has cost you $20.");
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerInVehicle(i, IsATaxi(GetPlayerVehicleID(i))) && newstate == PLAYER_STATE_DRIVER)
{
return GivePlayerCash(i, 20);
}
}
and so on..
Re: What will be the outcome? -
Pyrokid - 12.04.2009
Go test it.
Re: What will be the outcome? -
Norn - 12.04.2009
Yes, i don't understand why you would ask us, when you could simply test it yourself.
Re: What will be the outcome? -
Burridge - 12.04.2009
use 127.0.0.1:7777 to test it, thats the usefulness of it
Re: What will be the outcome? -
Lewwy - 13.04.2009
I asked for a reason. I have nobody to test with and it's a closed beta.
Re: What will be the outcome? -
FUNExtreme - 13.04.2009
Just the driver
Re: What will be the outcome? -
Danut - 13.04.2009
why u use : for(new i; i<MAX_PLAYERS; i++) and you don't use for(new i
= 0 ; i<MAX_PLAYERS; i++)
Re: What will be the outcome? -
Lewwy - 13.04.2009
Quote:
Originally Posted by FUNExtreme
Just the driver
|
That's all I needed..
Thank you.
Re: What will be the outcome? -
Pyrokid - 13.04.2009
Quote:
Originally Posted by MoroJr™
why u use : for(new i; i<MAX_PLAYERS; i++) and you don't use for(new i = 0 ; i<MAX_PLAYERS; i++)
|
Because you don't need it. New variables are automatically assigned 0.
Re: What will be the outcome? -
Danut - 13.04.2009
i didn't knew this
thx