New cmd's
#1

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
Reply
#2

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!
Reply
#3

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...
Reply
#4

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.
Reply
#5

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)