06.05.2013, 05:15
(
Последний раз редактировалось WellDone; 06.05.2013 в 06:35.
)
Hi everyone.
What do I need is to make spectating vehicle stop when admin enters it and also to not allow to start spectating it if admin is already there.
Unfortunately, I did not have any such experience previously, so my attempts to make it may seem funny. Here is my dialog for spectating vehicles:
Obviously wrong conditions are those which return "You are not allowed to spectate this vehicle, since an admin is sitting in it" and "Another administrator has entered the vehicle you're spectating,\nso spectating is stopped".
Please tell me how to make them in a right way.
Thank you in advance.
What do I need is to make spectating vehicle stop when admin enters it and also to not allow to start spectating it if admin is already there.
Unfortunately, I did not have any such experience previously, so my attempts to make it may seem funny. Here is my dialog for spectating vehicles:
pawn Код:
if(dialogid==105_2)//Spectating vehicle
{
if(response)
{
new tmp[255];
tmp = strtOK(inputtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, " You didn't enter vehicle ID.");
return 1;
}
specvehicleid = strval(tmp);
for(new i=0; i<MAXPLAYERS; i++)
{
if(IsPlayerInVehicle(i, specvehicleid)&&((tmpAdmin[i]==1&&admin[i]==1))||IsPlayerAdmin(i))
{
SendClientMessage(playerid,COLOR_RED," You are not allowed to spectate this vehicle, since an admin is sitting in it.");
return 1;
}
}
if(GetPlayerVehicleID(playerid)==specvehicleid) SendClientMessage(playerid,COLOR_RED," You cannot spectate vehicle you are sitting in.");
if(specvehicleid < MAX_VEHICLES)
{
TogglePlayerSpectating(playerid, 1);
PlayerSpectateVehicle(playerid, specvehicleid);
gSpectateID[playerid] = specvehicleid;
gSpectateType[playerid] = ADMIN_SPEC_TYPE_VEHICLE;
camer[playerid]=1;
format(string, sizeof(string), " You are spectating vehicle with ID %d. Press 2 to exit.",specvehicleid);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
for(new i=0; i<MAXPLAYERS; i++)
{
if(IsPlayerInVehicle(i, specvehicleid)&&((tmpAdmin[i]==1&&admin[i]==1))||IsPlayerAdmin(i))
{
TogglePlayerSpectating(playerid, 0);
gSpectateID[playerid] = INVALID_PLAYER_ID;
gSpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
SetPlayerVirtualWorld(playerid,0);
camer[playerid]=0;
ShowDialog(playerid,43,DIALOG_STYLE_MSGBOX,"Info","{FCAC00}Another administrator has entered the vehicle you're spectating,\nso spectating is stopped.","OK","");
return 1;
}
}
}
else SendClientMessage(playerid, COLOR_LIGHTBLUE, " Wrong ID.");
return 1;
}
else ShowDialog105(playerid);
}
Obviously wrong conditions are those which return "You are not allowed to spectate this vehicle, since an admin is sitting in it" and "Another administrator has entered the vehicle you're spectating,\nso spectating is stopped".
Please tell me how to make them in a right way.
Thank you in advance.