SA-MP Forums Archive
CMD refusing to work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: CMD refusing to work (/showthread.php?tid=395481)



CMD refusing to work - UnknownGamer - 26.11.2012

pawn Код:
if(strcmp(cmd, "/recovercar", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /recovercar [VehID]");
        new vehicleid = strval(tmp);

        if(PlayerInfo[playerid][pAdmin] >= 5)
        {
            SetVehicleToRespawn(vehicleid);
            SetVehicleVirtualWorld(vehicleid, 0);
            SendClientMessage(playerid, COLOR_GREY, "* Vehicle respawned, in VirtualWorld 0.");
        }
        return 1;
    }
Someone correct me, why does that not make the car re-spawn, back as its known position, in VW0?


Re : CMD refusing to work - vernz - 26.11.2012

Quote:

[pawm]

edit it please ! easier to read


Re: Re : CMD refusing to work - UnknownGamer - 26.11.2012

Quote:
Originally Posted by vernz
Посмотреть сообщение
edit it please ! easier to read
Whooooops


Re: CMD refusing to work - UnknownGamer - 26.11.2012

pawn Код:
if(strcmp(cmd, "/recovercar", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /recovercar [VehID]");
        new vehicleid = strval(tmp);

        if(PlayerInfo[playerid][pAdmin] >= 5)
        {
            SetVehicleToRespawn(vehicleid);
            SetVehicleVirtualWorld(vehicleid, 0);
            SendClientMessage(playerid, COLOR_GREY, "* Vehicle respawned, in VirtualWorld 0.");
            OnPropUpdate(4,vehicleid);
            OnPlayerUpdateEx(playerid);
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/gotocar", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /gotocar [carid]");
                return 1;
            }
            new testcar = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 4)
            {
                new vehworld = GetVehicleVirtualWorld(testcar);
                if (vehworld == 63 || 65) return SendClientMessage(playerid, COLOR_GREY, "Error! This vehicle is not spawned by it's owner.");
               
                new Float:cwx2,Float:cwy2,Float:cwz2;
                GetVehiclePos(testcar, cwx2, cwy2, cwz2);
                if (GetPlayerState(playerid) == 2)
                {
                    SetVehicleToRespawn(GetPlayerVehicleID(playerid));
                    SafeRemovePlayerFromVehicle(playerid);
                    SafeSetPlayerPos(playerid, cwx2,cwy2,cwz2+2);
                }
                else
                {
                    SafeSetPlayerInterior(playerid,0);
                    SafeSetPlayerPos(playerid, cwx2,cwy2,cwz2+2);
                }
                SendClientMessage(playerid, COLOR_ORANGE, "** You have been teleported");
                OnPlayerExitFood(playerid);
                format(string, sizeof(string), "[ADMIN]: %s Has Teleported Himself To Car: [%d].", sendername, testcar);
                ABroadCast(COLOR_LIGHTRED,string, 5);
                DisablePlayerCheckpoint(playerid);
                new y, m, d;
                new h,mi,s;
                getdate(y,m,d);
                gettime(h,mi,s);
                format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Teleported Himself to Car Id: [%d]",d,m,y,h,mi,s,sendername,testcar);
                TelesLog(string);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "** You are not authorized to use that command!");
                return 1;
            }
        }
        return 1;
    }
Can someone explain why I always get the error, car isnt spawned by the owner? -- That should work rite?


Re: CMD refusing to work - you10 - 26.11.2012

Should be if(vehworld == 63 || vehworld == 65)


Re: CMD refusing to work - UnknownGamer - 26.11.2012

Quote:
Originally Posted by you10
Посмотреть сообщение
Should be if(vehworld == 63 || vehworld == 65)
Thankyou! +REP