SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 19/07/2011, 04:26 AM   #1
Shockey HD
Gangsta
 
Shockey HD's Avatar
 
Join Date: Jul 2011
Posts: 671
Reputation: 14
Default I need some help with a goto command and gethere

ive been searching hours with my freind, and we just cant seem to get this command.

We are looking for a /goto command and a /gethere command using DCMD.

This is for an admin script so the if player is an a admin looks like this.

Code:
if(PInfo[playerid][Level] < 2) return SendClientMessage(playerid,COLOR_RED,"You need to be level 2 to use this command!");
__________________
Shockey HD is offline  
Old 19/07/2011, 04:47 AM   #2
[L3th4l]
Guest
 
Posts: n/a
Default Re: I need some help with a goto command and gethere

pawn Code:
#if !defined isnull
    #define isnull(%1) \
                ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif

dcmd_goto(playerid, params[])
{
    if(PInfo[playerid][Level] < 2) return SendClientMessage(playerid,COLOR_RED,"You need to be level 2 to use this command!");
    if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /Goto < Player ID >");

    new
        pID = strval(params),
        Float: iPos[3];

    GetPlayerPos(pID, iPos[0], iPos[1], iPos[2]);
    SetPlayerPos(playerid, iPos[0], iPos[1], iPos[2] + 3);

    new
        iStr[50],
        pIDN[24];

    GetPlayerName(pID, pIDN, sizeof(pIDN));

    format(iStr, sizeof(iStr), "You've teleported to: %s", pIDN);
    return SendClientMessage(playerid, -1, iStr);
}

dcmd_gethere(playerid, params[])
{
    if(PInfo[playerid][Level] < 2) return SendClientMessage(playerid,COLOR_RED,"You need to be level 2 to use this command!");
    if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /Gethere < Player ID >");
   
    new
        pID = strval(params),
        Float: iPos[3];

    GetPlayerPos(playerid, iPos[0], iPos[1], iPos[2]);
    SetPlayerPos(pID, iPos[0], iPos[1], iPos[2] + 3);
   
    new
        iStr[50],
        pIDN[24];

    GetPlayerName(pID, pIDN, sizeof(pIDN));

    format(iStr, sizeof(iStr), "You've teleported: %s to you", pIDN);
    return SendClientMessage(playerid, -1, iStr);
}
 
Old 19/07/2011, 04:55 AM   #3
Shockey HD
Gangsta
 
Shockey HD's Avatar
 
Join Date: Jul 2011
Posts: 671
Reputation: 14
Default Re: I need some help with a goto command and gethere

Quote:
Originally Posted by [L3th4l] View Post
pawn Code:
#if !defined isnull
    #define isnull(%1) \
                ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif

dcmd_goto(playerid, params[])
{
    if(PInfo[playerid][Level] < 2) return SendClientMessage(playerid,COLOR_RED,"You need to be level 2 to use this command!");
    if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /Goto < Player ID >");

    new
        pID = strval(params),
        Float: iPos[3];

    GetPlayerPos(pID, iPos[0], iPos[1], iPos[2]);
    SetPlayerPos(playerid, iPos[0], iPos[1], iPos[2] + 3);

    new
        iStr[50],
        pIDN[24];

    GetPlayerName(pID, pIDN, sizeof(pIDN));

    format(iStr, sizeof(iStr), "You've teleported to: %s", pIDN);
    return SendClientMessage(playerid, -1, iStr);
}

dcmd_gethere(playerid, params[])
{
    if(PInfo[playerid][Level] < 2) return SendClientMessage(playerid,COLOR_RED,"You need to be level 2 to use this command!");
    if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /Gethere < Player ID >");
   
    new
        pID = strval(params),
        Float: iPos[3];

    GetPlayerPos(playerid, iPos[0], iPos[1], iPos[2]);
    SetPlayerPos(pID, iPos[0], iPos[1], iPos[2] + 3);
   
    new
        iStr[50],
        pIDN[24];

    GetPlayerName(pID, pIDN, sizeof(pIDN));

    format(iStr, sizeof(iStr), "You've teleported: %s to you", pIDN);
    return SendClientMessage(playerid, -1, iStr);
}
Unkown Command
__________________
Shockey HD is offline  
Old 19/07/2011, 05:20 AM   #4
Skaizo
Gangsta
 
Skaizo's Avatar
 
Join Date: Sep 2010
Location: Romanian
Posts: 862
Reputation: 15
Default Re: I need some help with a goto command and gethere

try this:
Code:
dcmd_goto(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] == 0) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
    {
        new targetid;
        if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /goto [playerid | name]");
        else if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFAA, "That player is not connected");
        {
            new Float:PosX, Float:PosY, Float:PosZ;
            GetPlayerPos(targetid, PosX, PosY, PosZ);
            SetPlayerPos(playerid, PosX, PosY, PosZ);
            SetPlayerInterior(playerid, GetPlayerInterior(targetid));
            SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(targetid));
        }
    }
    return 1;
}
you need dcmd and sscanf
__________________
My works(Romanian)
Thanks To Jansish For Signature
[Tutorial]rezolvarea eroare pawno failed to set data for si File or function is not found
I am Russian?
No
You are Russian army fuck?
Yes but no Fuck
Lol )
Skaizo is offline  
Old 19/07/2011, 05:23 AM   #5
Shockey HD
Gangsta
 
Shockey HD's Avatar
 
Join Date: Jul 2011
Posts: 671
Reputation: 14
Default Re: I need some help with a goto command and gethere

For every command i have Goto or Gethere it sends back UNkown Server command
__________________
Shockey HD is offline  
Old 19/07/2011, 06:01 AM   #6
coole210
High-roller
 
Join Date: Jul 2008
Location: Canada
Posts: 1,023
Reputation: 84
Default Re: I need some help with a goto command and gethere

Did you forget to add
Code:
dcmd(goto,4,cmdtext);
to the OnPlayerCommandText?
coole210 is offline  
Old 19/07/2011, 07:29 AM   #7
Shockey HD
Gangsta
 
Shockey HD's Avatar
 
Join Date: Jul 2011
Posts: 671
Reputation: 14
Default Re: I need some help with a goto command and gethere

Quote:
Originally Posted by coole210 View Post
Did you forget to add
Code:
dcmd(goto,4,cmdtext);
to the OnPlayerCommandText?
Of course not
__________________
Shockey HD is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Commande Goto et gethere Tommynico Français/French 0 07/03/2011 07:29 PM
Need Command Goto (ZCMD) SamyRomafia Help Archive 5 01/01/2011 08:42 PM
Problem with /goto command sobolanux Help Archive 0 10/04/2010 01:35 PM
How to make a /gethere «id» and /goto «id» command? Rubennnnn Help Archive 12 02/12/2009 06:42 AM
/getgun & /armour & /goto command WanabePC Help Archive 3 22/04/2009 06:49 PM


All times are GMT. The time now is 10:54 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.