need a "command" - 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: need a "command" (
/showthread.php?tid=477499)
need a "command" -
Toxykx - 24.11.2013
how can i make when i click on button [Tab] so it shows me a menu of all player and if i cllick on some player its teleports me to him
Please help me!
[cmd only for admins level 5]
Re: need a "command" -
Avi Raj - 24.11.2013
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
new targetid;
if(targetid != INVALID_PLAYER_ID)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(targetid, x, y, z);
SetPlayerPos(playerid, x, y, z);
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(targetid));
SetPlayerInterior(playerid, GetPlayerInterior(targetid));
}
else return SendClientMessage(playerid, 0xFFAA00, "ERROR: invalid playerid");
}
return 1;
}
Re: need a "command" -
Toxykx - 24.11.2013
Quote:
Originally Posted by Avi Raj
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source) { new targetid; if(targetid != INVALID_PLAYER_ID) { new Float:x, Float:y, Float:z; GetPlayerPos(targetid, x, y, z); SetPlayerPos(playerid, x, y, z); SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(targetid)); SetPlayerInterior(playerid, GetPlayerInterior(targetid)); } else return SendClientMessage(playerid, 0xFFAA00, "ERROR: invalid playerid"); } return 1; }
|
Error :
Quote:
C:\Users\xxxxx\Desktop\Ross County RP(3)\Ross County RP\gamemodes\rc.pwn(1285 : warning 217: loose indentation
C:\Users\xxxxx\Desktop\Ross County RP(3)\Ross County RP\gamemodes\rc.pwn(12859) : warning 217: loose indentation
C:\Users\xxxxx\Desktop\Ross County RP(3)\Ross County RP\gamemodes\rc.pwn(12863) : warning 209: function "S@@_OnPlayerClickPlayer" should return a value
C:\Users\xxxxx\Desktop\Ross County RP(3)\Ross County RP\gamemodes\rc.pwn(12864) : error 010: invalid function or declaration
C:\Users\xxxxx\Desktop\Ross County RP(3)\Ross County RP\gamemodes\rc.pwn(31405) : error 021: symbol already defined: "S@@_OnPlayerClickPlayer"
|
Re: need a "command" -
SuperViper - 24.11.2013
The code Avi Raj posted won't work.
Insert this code into the
OnPlayerClickPlayer callback which you already have in your script:
pawn Код:
if(----- YOUR ADMIN VARIABLE ----- >= 5)
{
new Float: playersPosition[3];
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(clickedplayerid));
SetPlayerInterior(playerid, GetPlayerInterior(clickedplayerid));
GetPlayerPos(clickedplayerid, playersPosition[0], playersPosition[1], playersPosition[2]);
SetPlayerPos(playerid, playersPosition[0], playersPosition[1], playersPosition[2]);
}
Replace
----- YOUR ADMIN VARIABLE ----- with your actual admin variable which is commonly
PlayerInfo[playerid][pAdmin], but can differ among scripts.
Re: need a "command" -
roca - 24.11.2013
well i also needed the same thing but its kinda easy now.. i know how to do that but you need to tell if you are using ZCMD or something..
Re: need a "command" -
Toxykx - 24.11.2013
Quote:
Originally Posted by SuperViper
The code Avi Raj posted won't work.
Insert this code into the OnPlayerClickPlayer callback which you already have in your script:
pawn Код:
if(----- YOUR ADMIN VARIABLE ----- >= 5) { new Float: playersPosition[3];
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(clickedplayerid)); SetPlayerInterior(playerid, GetPlayerInterior(clickedplayerid));
GetPlayerPos(clickedplayerid, playersPosition[0], playersPosition[1], playersPosition[2]); SetPlayerPos(playerid, playersPosition[0], playersPosition[1], playersPosition[2]); }
Replace ----- YOUR ADMIN VARIABLE ----- with your actual admin variable which is commonly PlayerInfo[playerid][pAdmin], but can differ among scripts.
|
can you please make it like : "FileScript" Ty!!
Re: need a "command" -
Toxykx - 25.11.2013
help me please
Re: need a "command" - Astralis - 26.11.2013
Quote:
Originally Posted by Toxykx
can you please make it like : "FileScript" Ty!!
|
he already told you to add it under OnPlayerClickPlayer in your game mode, so you don't and won't need any filterscript.