Script help -
boyan96 - 01.05.2012
How i can make this two functions in one'
First
PHP код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new msg[255];
if (newstate==PLAYER_STATE_DRIVER)
{
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
{
if (avisado[playerid]==-1)
{
GameTextForPlayer(playerid,"~w~Press ~b~Buttom 2~n~~w~to start the ~n~~r~TAXI~w~ Minimissions.",3000,5);
}
else
{
KillTimer(avisado[playerid]);
avisado[playerid]=-1;
}
}
}
if (newstate==PLAYER_STATE_ONFOOT)
{
if ((playerInMiniMission[playerid]>0)&&(avisado[playerid]==-1))
{
GameTextForPlayer(playerid,"~w~You have ~r~10 sec ~n~~w~ to enter a ~r~TAXI",3000,4);
avisado[playerid]=SetTimerEx("terminarMission",10000,0,"%d",playerid);
}
if (OnTaxiAsPassenger[playerid]!=-1)
{
new taxista = OnTaxiAsPassenger[playerid];
new name[MAX_PLAYER_NAME];
GetPlayerName(taxista,name,MAX_PLAYER_NAME);
OnTaxiAsPassenger[playerid]=-1;
new viaje = CostoDelViaje[playerid];
format(msg,sizeof(msg),"~w~You pay to ~g~%s ~n~~r~$%d~w~ for the ~r~taxi~w~ ride.",name,viaje);
GameTextForPlayer(playerid,msg,3000,4);
format(msg,sizeof(msg),"~w~You get ~r~$%d~w~ ~n~for the ~r~taxi~w~ ride.",viaje);
GameTextForPlayer(taxista,msg,3000,4);
GivePlayerMoney(playerid,-viaje);
GivePlayerMoney(taxista,viaje);
cantidadPasajeros--;
if (cantidadPasajeros==0)
{
KillTimer(caidadefichaTimer);
}
}
}
if (newstate==PLAYER_STATE_PASSENGER)
{
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
{
new i=0;
while (i<MAX_PLAYERS)
{
if ((playerInMiniMission[i]==1)&&(GetPlayerState(i)==PLAYER_STATE_DRIVER))
{
if (GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
{
new name[MAX_PLAYER_NAME];
GetPlayerName(i,name,MAX_PLAYER_NAME);
contador[i]++;
format(msg,sizeof(msg),"~w~You have gotten into ~n~~g~%s's ~r~TAXI~w~",name);
GameTextForPlayer(playerid,msg,3000,4);
format(msg,sizeof(msg),"~w~You have one new~n~~r~PASENGER~w~");
GameTextForPlayer(playerid,msg,3000,4);
OnTaxiAsPassenger[playerid]=i;
CostoDelViaje[playerid]=BAJADA_DE_BANDERA;
if (cantidadPasajeros==0)
{
caidadefichaTimer=SetTimer("caidadeficha",30000,1);
}
cantidadPasajeros++;
i=MAX_PLAYERS;
}
}
i++;
}
}
}
return 1;
}v
The second
PHP код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(LicenseInfo[playerid][Car] < 1)
{
switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
{
case 430, 417, 425, 446, 452, 453, 454, 464, 465, 469, 472, 473, 476, 484, 487, 488, 493, 497, 501, 511, 512, 513, 519, 553, 563, 577, 592, 593, 595, 447: //Vehicle IDs.
{
SendClientMessage(playerid, 0xFF6347AA, "111111111111111111111111111111!");
RemovePlayerFromVehicle(playerid);
}
}
}
}
return 1;
}
Re: Script help -
warcodes_ - 01.05.2012
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new msg[255];
if (newstate==PLAYER_STATE_DRIVER)
{
if(LicenseInfo[playerid][Car] < 1)
{
switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
{
case 430, 417, 425, 446, 452, 453, 454, 464, 465, 469, 472, 473, 476, 484, 487, 488, 493, 497, 501, 511, 512, 513, 519, 553, 563, 577, 592, 593, 595, 447: //Vehicle IDs.
{
SendClientMessage(playerid, 0xFF6347AA, "111111111111111111111111111111!");
RemovePlayerFromVehicle(playerid);
}
}
}
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
{
if (avisado[playerid]==-1)
{
GameTextForPlayer(playerid,"~w~Press ~b~Buttom 2~n~~w~to start the ~n~~r~TAXI~w~ Minimissions.",3000,5);
}
else
{
KillTimer(avisado[playerid]);
avisado[playerid]=-1;
}
}
}
if (newstate==PLAYER_STATE_ONFOOT)
{
if ((playerInMiniMission[playerid]>0)&&(avisado[playerid]==-1))
{
GameTextForPlayer(playerid,"~w~You have ~r~10 sec ~n~~w~ to enter a ~r~TAXI",3000,4);
avisado[playerid]=SetTimerEx("terminarMission",10000,0,"%d",playerid);
}
if (OnTaxiAsPassenger[playerid]!=-1)
{
new taxista = OnTaxiAsPassenger[playerid];
new name[MAX_PLAYER_NAME];
GetPlayerName(taxista,name,MAX_PLAYER_NAME);
OnTaxiAsPassenger[playerid]=-1;
new viaje = CostoDelViaje[playerid];
format(msg,sizeof(msg),"~w~You pay to ~g~%s ~n~~r~$%d~w~ for the ~r~taxi~w~ ride.",name,viaje);
GameTextForPlayer(playerid,msg,3000,4);
format(msg,sizeof(msg),"~w~You get ~r~$%d~w~ ~n~for the ~r~taxi~w~ ride.",viaje);
GameTextForPlayer(taxista,msg,3000,4);
GivePlayerMoney(playerid,-viaje);
GivePlayerMoney(taxista,viaje);
cantidadPasajeros--;
if (cantidadPasajeros==0)
{
KillTimer(caidadefichaTimer);
}
}
}
if (newstate==PLAYER_STATE_PASSENGER)
{
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
{
new i=0;
while (i<MAX_PLAYERS)
{
if ((playerInMiniMission[i]==1)&&(GetPlayerState(i)==PLAYER_STATE_DRIVER))
{
if (GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
{
new name[MAX_PLAYER_NAME];
GetPlayerName(i,name,MAX_PLAYER_NAME);
contador[i]++;
format(msg,sizeof(msg),"~w~You have gotten into ~n~~g~%s's ~r~TAXI~w~",name);
GameTextForPlayer(playerid,msg,3000,4);
format(msg,sizeof(msg),"~w~You have one new~n~~r~PASENGER~w~");
GameTextForPlayer(playerid,msg,3000,4);
OnTaxiAsPassenger[playerid]=i;
CostoDelViaje[playerid]=BAJADA_DE_BANDERA;
if (cantidadPasajeros==0)
{
caidadefichaTimer=SetTimer("caidadeficha",30000,1);
}
cantidadPasajeros++;
i=MAX_PLAYERS;
}
}
i++;
}
}
}
return 1;
}
That should work.
Re: Script help -
boyan96 - 01.05.2012
no this didn't work
Re: Script help -
warcodes_ - 01.05.2012
Quote:
Originally Posted by boyan96
no this didn't work
|
If this is the case, they didn't work before, as i simply added the if statement from one to the other, without fail and/or errors.