How to get PVars to be sent to another player.
#1

Hi all,
I have a script, that i am currently using PVars with. I have a PVar that saves a randomly generated mission number. (Like this:
pawn Код:
new rand;
rand = random(sizeof(MissionArray));
SetPVarInt(playerid, "PlayerMission", rand);
When i type a command in game, (/convoy _) with a players ID after it, the script should select that Players ID (the one you type in the command) and copy their mission to the player that typed it. But when i do type it, it says "Unknown Command" and doesnt do anything. Whereas if i just type /convoy, it says *because i asked it to: USAGE: /convoy [playerid]

If anyone needs me to post the bits of the script more fully then let me know. Below is the command:

pawn Код:
//Convoy Stuff
   
    new cmd[128], idx;
    cmd = strtok(cmdtext, idx);
   
    if (strcmp("/convoy", cmdtext, false) == 0)
    {
        new thing[128];
        thing = strtok(cmdtext, idx);
        if (strlen(thing) == 0)
        {
            SendClientMessage(playerid, WORK, "USAGE: /convoy [playerid]");
        }

        rand = GetPVarInt(strlen(thing), "PlayerMission");

        if (GetPlayerTeam(playerid) == 1)
        {
            new m = GetVehicleModel(GetPlayerVehicleID(playerid));
            if(m == 514 || m == 515 || m == 403)
            {
                new t = GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(playerid)));
                if (t == 435 || t == 450 || t == 584)
                {
                    if (GetPlayerVehicleSeat(playerid) == 0)
                    {

                        Trucker1(playerid);
                        SendClientMessage(playerid, WORK, "If you lose your trailer, you will need to re-attach it to deliver");
                    }
                    else
                    {
                        SendClientMessage(playerid, WORK, "You are not the driver of this vehicle");
                    }
                }
                else
                {
                    SendClientMessage(playerid, WORK, "You do not have the correct trailer, please go and attach one!");
                }
            }
            else
            {
                SendClientMessage(playerid, WORK, "You are not in a truck, please go and get one!");
            }
            return 1;
        }
Thanks
Ash
Reply
#2

new giveplayerid = ReturnUser(thing);
rand = GetPVarInt(giveplayerid, "PlayerMission");

hope that helps
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)