27.05.2011, 15:22
I had problems yesterday with this,and I'm kinda new to "loops" .A beta tester told me :"You should be using the loop to identify the ID of the driver of the ambulance and then storing that ID for later use. See usage of GetPlayerVehicleID and comparing it to vehicleid passed by the callback."
I'm new to loops so please help,gvie me an example and pls don't give me just the wiki@loops
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new playerid2;
if(gTeam[playerid2] == TEAM_MEDICS)
{
if(GetPlayerState(playerid2) == PLAYER_STATE_DRIVER && GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
GetVehicleModel(vehicleid);
if(vehicleid == 416)
{
new Float:health;
GetPlayerHealth(playerid,health);
if(health < 80)
{
SetPlayerHealth(playerid,100);
GivePlayerMoney(playerid,-500);
GivePlayerMoney(playerid2,500);
SetPlayerScore(playerid2,GetPlayerScore(playerid2) + 2);
new medicname[24];
new healedname[24];
new string[128];
GetPlayerName(playerid,healedname,sizeof(healedname));
GetPlayerName(playerid2,medicname,sizeof(medicname));
format(string,sizeof(string),"%s has been healed by medic %s.",healedname,medicname);
SendClientMessageToAll(COLOR_GREY,string);
}
}
}
}
return 1;
}