Grabbing virtual worlds then setting them?
#1

Is this possible, im working on a /goto and a /gethere commands and i want it to grab the "ID's" Virutal World then set it for the playerid, but is there a way to do it without getting


PHP код:
warning 202number of arguments does not match definition 
I know the reason of this warning its because that the code should be

SetPlayerVirtualWorld(playerid,0);

How would i set it so that it grabs the Ids Virtual world?

I know that im pretty much on the right track, heres my code.

pawn Код:
CMD:goto(playerid,params[])
{
    new id,Float:X,Float:Y,Float:Z,pName[MAX_PLAYER_NAME],string[126],iName[MAX_PLAYER_NAME],string2[126];
    if(sscanf(params, "u",id))SendClientMessage(playerid,COLOR_RED,"Usage: /Goto [ID]");
    if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "System: Invalid ID");
    else
    {
   
        GetPlayerVirtualWorld(id);
        SetPlayerVirtualWorld(playerid);
        GetPlayerInterior(id);
        SetPlayerInterior(playerid);
        GetPlayerPos(id,X,Y,Z);
        SetPlayerPos(playerid,X,Y,Z);
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        format(string,128,"Admin %s has teleported to you",pName);
        SendClientMessage(id,COLOR_ORANGE,string);
        GetPlayerName(id, iName, MAX_PLAYER_NAME);
        format(string2,128,"You have gone to %s",iName);
        SendClientMessage(id,COLOR_ORANGE,string2);
    }
    return 1;
}
Reply
#2

what line is
Код:
warning 202: number of arguments does not match definition
on
Reply
#3

If you read the post, you should be able to tell that im refering to SetPlayerVirtualWorld(playerid);

Reply
#4

GetPlayerVirtualWorld(id); this returns a value (the virtualworld of the player).
You have two choices:
1) store it in a variable, then use it in SetPlayerVirtualWorld:
pawn Код:
new worldid = GetPlayerVirtualWorld(id);
SetPlayerVirtualWorld(playerid, worldid);
2) you can merge the two functions, by this way you don't need a variable.
pawn Код:
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
For more instance, check out variables: https://sampwiki.blast.hk/wiki/Scripting_Basics#Variables
Reply
#5

pawn Код:
CMD:goto(playerid,params[])
{
    new id,Float:X,Float:Y,Float:Z,pName[MAX_PLAYER_NAME],string[126],iName[MAX_PLAYER_NAME],string2[126];
    if(sscanf(params, "u",id))SendClientMessage(playerid,COLOR_RED,"Usage: /Goto [ID]");
    if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "System: Invalid ID");
    else
    {
   
        new vWorld = GetPlayerVirtualWorld(id);
        SetPlayerVirtualWorld(playerid,vWorld);
        GetPlayerInterior(id);
        SetPlayerInterior(playerid);
        GetPlayerPos(id,X,Y,Z);
        SetPlayerPos(playerid,X,Y,Z);
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        format(string,128,"Admin %s has teleported to you",pName);
        SendClientMessage(id,COLOR_ORANGE,string);
        GetPlayerName(id, iName, MAX_PLAYER_NAME);
        format(string2,128,"You have gone to %s",iName);
        SendClientMessage(id,COLOR_ORANGE,string2);
    }
    return 1;
}
Reply
#6

pawn Код:
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
And put this above it

pawn Код:
new worldid = GetPlayerVirtualWorld(id);
Reply
#7

and the same goes to Interior.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)