SA-MP Forums Archive
New cmd's - 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: New cmd's (/showthread.php?tid=327121)



New cmd's - Mr.Lauren - 19.03.2012

Allright, I got none to edit, just can anyone explain to me how to get more cmd's? Here's the code..

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mytp", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid,1602.3510,-1034.1279,23.9063);
SendClientMessage(playerid, COLOR_YELLOW , "You have been successfully teleported to the location.");

}
return 0;
}

With that, how can I set more tp locations etc...I am a begginer, sorry for the trouble. Thanks


Re: New cmd's - Basicz - 19.03.2012

pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if ( !strcmp( cmdtext, "/mytp", true ) )
    {
        SetPlayerPos( playerid, 1602.3510, -1034.1279, 23.9063 );
        SendClientMessage( playerid, COLOR_YELLOW, "You have been successfully teleported to the location." );
        return 1;
    }

    // new command
 
    if ( !strcmp( cmdtext, "/mytp2", true ) )
    {
        SetPlayerPos( playerid, 0.0, 0.0, 5.0 ); // Teleports the player to the middle of SA.
        SendClientMessage( playerid, COLOR_YELLOW, "You have been successfully teleported to the location." );

        return 1;
    }

    // and on ..

    return 0;
}
But, I recommend you ZCMD. It's more easier and faster!


Re: New cmd's - Mr.Lauren - 19.03.2012

Quote:
Originally Posted by Basicz
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if ( !strcmp( cmdtext, "/mytp", true ) )
    {
        SetPlayerPos( playerid, 1602.3510, -1034.1279, 23.9063 );
        SendClientMessage( playerid, COLOR_YELLOW, "You have been successfully teleported to the location." );
        return 1;
    }

    // new command
 
    if ( !strcmp( cmdtext, "/mytp2", true ) )
    {
        SetPlayerPos( playerid, 0.0, 0.0, 5.0 ); // Teleports the player to the middle of SA.
        SendClientMessage( playerid, COLOR_YELLOW, "You have been successfully teleported to the location." );

        return 1;
    }

    // and on ..

    return 0;
}
But, I recommend you ZCMD. It's more easier and faster!
Thanks, but what's ZCMD, I am kinda first day at scripting...


Re: New cmd's - Face9000 - 19.03.2012

Quote:
Originally Posted by Mr.Lauren
Посмотреть сообщение
With that, how can I set more tp locations etc...I am a begginer, sorry for the trouble. Thanks
Instead of creating new cmds for every teleport,use a dialog_style_list for that.
ZCMD is a command processor.


Re: New cmd's - ricardo178 - 19.03.2012

I recommend you to read some tutorials about begining with scripting.


Re: New cmd's - Skribblez - 19.03.2012

it's a command processor, makes it easier for you to implement new commands especially when you use it with sscanf. here's a link that shows most of the helpful things on the sa-mp forums.

https://sampforum.blast.hk/showthread.php?tid=283602