06.12.2014, 22:17
Does the function itself acutally gets called?
Try to debug it by puting some prints on different places in the funtion, then run the server, send yourself to the hospital, quit sa-mp, check the serverlog and see how the funtion handled.
Did the function get called? Did it start the loop, did it found an empty bed or not?
Example:
Try to debug it by puting some prints on different places in the funtion, then run the server, send yourself to the hospital, quit sa-mp, check the serverlog and see how the funtion handled.
Did the function get called? Did it start the loop, did it found an empty bed or not?
Example:
pawn Код:
stock PlaceToHospitalBed(playerid)
{
print("PlaceHospitalBed called");
new bool: full = true;
for (new i; i < sizeof (LigoninesLovos); ++i)
{
printf("Loop #%d - BedTaken: %d", i, LigoninesLovos[i][LL_taken]);
if (LigoninesLovos[i][LL_taken] == false)
{
print("Empty bed found");
full = false;
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid, LigoninesLovos[Random][LL_pos][0], LigoninesLovos[Random][LL_pos][1], LigoninesLovos[Random][LL_pos][2]);
SetPlayerFacingAngle(playerid, LigoninesLovos[Random][LL_pos][3]);
ApplyAnimation(playerid,"CRACK","crckdeth2",4.1, 0, 1, 1, 1, 0);
TogglePlayerSpectating(playerid, 1);
TogglePlayerControllable(playerid, 0);
InterpolateCameraPos(playerid, -200.499435, -1758.981567, 677.898132, -200.831359, -1772.208251, 677.901367, 20000);
InterpolateCameraLookAt(playerid, -198.193222, -1763.108764, 676.270874, -198.342041, -1768.232177, 676.171081, 20000);
SendClientMessage(playerid, CHATCOLOR_RED, "Siek tiek turesi palaukti kol pagysi!");
LigoninesLovos[i][LL_taken] = true;
print("Player send to hospital");
break;
}
}
print("Loop finished");
if (full)
{
print("All beds are full");
SetPlayerPos(playerid,-202.3200,-1761.7898,675.7687);
SendClientMessage(playerid,CHATCOLOR_RED,"Palatose nera vietu todel buvai greit pagydytas ant operacinio stalo.");
}
print("End of function");
return 1;
}