20.03.2010, 14:29
It works when I type /spec [id] while he/she is in a vehicle, but when the player leaves the vehicle, I keep specing the vehicle. Also when I'm specing someone on foot, and the player enters the car, I will see the inside of the car...
What is wrong?
What is wrong?
pawn Код:
dcmd_spec(playerid, params[])
{
new index = 0;
tmp2 = strtok(params, index);
if (pInfo[playerid][pAdmin] < 1)
{
SystemMessage(playerid, "You are not an Administrator with the required level.");
return 1;
}
if(!strlen(tmp2))
{
SystemMessage(playerid, "[USAGE] ''/spec [playername/id]''.");
return 1;
}
new string[MAX_STRING];
new second, minute, hour, day, month, year;
giveplayerid = ReturnUser(tmp2);
if(IsPlayerConnected(giveplayerid))
{
TogglePlayerSpectating(playerid, 1);
if(!IsPlayerInAnyVehicle(giveplayerid)) PlayerSpectatePlayer(playerid, giveplayerid);
else PlayerSpectateVehicle(playerid, GetPlayerVehicleID(giveplayerid), SPECTATE_MODE_NORMAL);
SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
gSpectateID[playerid] = giveplayerid;
gSpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER;
gettime(hour, minute, second);
getdate(year, month, day);
format(string, sizeof(string), "Player %s started spectating player %s on %d/%d/%d at %d:%d:%d.", PlayerName(playerid), PlayerName(giveplayerid), month, day, year, hour, minute, second);
ServerLog(string);
printf(string);
}
else
{
format(string, sizeof(string), "That player is not active.");
SystemMessage(playerid, string);
}
return 1;
}