Grabbing virtual worlds then setting them? -
Shockey HD - 19.08.2011
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 202: number 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;
}
Re: Grabbing virtual worlds then setting them? -
Zonoya - 19.08.2011
what line is
Код:
warning 202: number of arguments does not match definition
on
Re: Grabbing virtual worlds then setting them? -
Shockey HD - 19.08.2011
If you read the post, you should be able to tell that im refering to SetPlayerVirtualWorld(playerid);
Re: Grabbing virtual worlds then setting them? -
KoczkaHUN - 19.08.2011
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
Re: Grabbing virtual worlds then setting them? -
[MWR]Blood - 19.08.2011
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;
}
Re: Grabbing virtual worlds then setting them? -
=WoR=G4M3Ov3r - 19.08.2011
pawn Код:
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
And put this above it
pawn Код:
new worldid = GetPlayerVirtualWorld(id);
Re: Grabbing virtual worlds then setting them? -
KoczkaHUN - 19.08.2011
and the same goes to Interior.