Spec saving off
#1

Im here for another problem, im trying to save the current admin position while doing /spec, and setting him to the saved position with /specoff, but doesn't work. I get respawned as normal..

pawn Код:
CMD:spec(playerid, params[])
{
    if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
    if(pInfo[playerid][Admin] >= 1)
    {
        new targetid;
        if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, -1, "{F70505}Usage: {FFFFFF}/spec [playerid]");
        {
            if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "SERVER: Player not connected");
            new Float:xpoz,Float:ypoz,Float:zpoz;
            GetPlayerPos(playerid,xpoz,ypoz,zpoz);
            SetPVarFloat(playerid,"XPos",xpoz); SetPVarFloat(playerid,"YPos",ypoz); SetPVarFloat(playerid,"ZPos",zpoz);
            new string[150];
            new sstring[250];
            new pname[24];
            GetPlayerName(targetid,pname,24);
            new Float:gihp, Float:giar;
            GetPlayerHealth(targetid, gihp);
            GetPlayerArmour(targetid, giar);
            TogglePlayerSpectating(playerid, 1);
            if(IsPlayerInAnyVehicle(targetid))
            {
                new vehicleid = GetPlayerVehicleID(targetid);
                PlayerSpectateVehicle(playerid, vehicleid);
            }
            else
            {
                PlayerSpectatePlayer(playerid, targetid);
                SetPlayerInterior(playerid,GetPlayerInterior(targetid));
            }
            format(string, sizeof(string), "** You are now spectating %s (%d) - Type /specoff when you're done.", pname, targetid, GetPlayerPing(targetid));
            format(sstring, sizeof(sstring), "** Ping: %d - Money: %i - Health: %0.1f - Armour: %0.1f", GetPlayerPing(targetid),GetPlayerMoney(targetid),gihp,giar);
            SendClientMessage(playerid, 0x0080C0FF, string);
            SendClientMessage(playerid, 0x0080C0FF, sstring);
        }
    }
    else SendClientMessage(playerid, red, "You do not have access to this command!");
    return 1;
}

CMD:specoff(playerid, params[])
{
    if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
    if(pInfo[playerid][Admin] >= 1)
    {
        SetPlayerPosEx(playerid, GetPVarFloat(playerid,"XPos"), GetPVarFloat(playerid,"YPos"), GetPVarFloat(playerid,"ZPos"));
        TogglePlayerSpectating(playerid, 0);
        SendClientMessage(playerid, red, "INFO: You have cancelled spectating.");
        SetPlayerInterior(playerid, 0);
    }
    else SendClientMessage(playerid, red, "You do not have access to this command!");
    return 1;
}
Reply


Messages In This Thread
Spec saving off - by Face9000 - 11.05.2013, 20:25
AW: Spec saving off - by Nero_3D - 11.05.2013, 20:31
Re: Spec saving off - by Face9000 - 11.05.2013, 20:34
Re: Spec saving off - by MP2 - 11.05.2013, 20:42
Re: Spec saving off - by Face9000 - 11.05.2013, 20:49
AW: Spec saving off - by Nero_3D - 11.05.2013, 21:15
Re: Spec saving off - by Face9000 - 11.05.2013, 21:26
AW: Re: Spec saving off - by Nero_3D - 11.05.2013, 21:57
Re: Spec saving off - by Face9000 - 12.05.2013, 09:35
AW: Spec saving off - by Nero_3D - 12.05.2013, 10:19

Forum Jump:


Users browsing this thread: 1 Guest(s)