Simple cmds.
#1

Hello guys i want to ask a simple question:
OK first, i need help with the /help cmd.Like someone types /help an scrren appears with all help.
Second i need help with basic teleport cmds.Like /drift1-2-3-4 etc.


Thank you,
Reply
#2

On top

pawn Код:
#define COLOR_WHITE 0xFFFFFFFF
Anywhere below

pawn Код:
CMD:help(playerid, params[])
    {
        SendClientMessage(playerid, COLOR_WHITE, "- Command list");
        SendClientMessage(playerid, COLOR_WHITE, "/kill, /heal etc...");
        return 1;
    }
Reply
#3

Quote:
Originally Posted by freshOrange
Посмотреть сообщение
pawn Код:
CMD:help(playerid, params[])
    {
        SendClientMessage(playerid, COLOR_WHITE, "- Command list");
        SendClientMessage(playerid, COLOR_WHITE, "/kill, /heal etc...");
        return 1;
    }
Pretty fast!!Thanks but how about teleports?
Reply
#4

Give us coordinates where to teleport.
Reply
#5

Same with the help command just use the SetPlayerPos function inside:

pawn Код:
CMD:drift1(playerid, params[]) {
    SetPlayerPos(playerid, 0.0, 0.0, 0.0);
    SendClientMessage(playerid, COLOR_WHITE, "You're at drift 1!");
    return 1;
}
Reply
#6

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
Same with the help command just use the SetPlayerPos function inside:

pawn Код:
CMD:drift1(playerid, params[]) {
    SetPlayerPos(playerid, 0.0, 0.0, 0.0);
    SendClientMessage(playerid, COLOR_WHITE, "You're at drift 1!");
    return 1;
}
you sure he uses ZCMD?.
Reply
#7

is this allright:
if (strcmp("/drift1", cmdtext, true, 10) == 0)
SetPlayerPos(playerid, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_WHITE, "You're at drift 1!");
return 1;
Reply
#8

Quote:
Originally Posted by steve_gibson
Посмотреть сообщение
is this allright:
if (strcmp("/drift1", cmdtext, true, 10) == 0)
SetPlayerPos(playerid, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_WHITE, "You're at drift 1!");
return 1;
Add brackets and put that under OnPlayerCommandText

Should work after that, though I'd recommend a command processer such as Y-CMD or ZCMD, easy to use and they're fast!
Reply
#9

Quote:
Originally Posted by steve_gibson
Посмотреть сообщение
is this allright:
if (strcmp("/drift1", cmdtext, true, 10) == 0)
SetPlayerPos(playerid, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_WHITE, "You're at drift 1!");
return 1;
Thats perfectly fine, however, don't forget your brackets!

It SHOULD look like this:

pawn Код:
if (strcmp("/drift1", cmdtext, true, 10) == 0)
{//You missed this
    SetPlayerPos(playerid, 0.0, 0.0, 0.0); //Make sure you change the co-ordinates!
    SendClientMessage(playerid, COLOR_WHITE, "You're at drift 1!");
    return 1;
}//You also missed this!
Edit: Lorenc_ beat my slow internet connection
Reply
#10

Quote:
Originally Posted by freshOrange
Посмотреть сообщение
pawn Код:
CMD:drift1(playerid, params[])
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
        SetPlayerPos(playerid,0.0,0.0,6.0);
        }
        else
        SetPlayerPos(playerid,0.0,0.0,6.0);
        return 1;
    }
This will check if you are on foot and teleport, and if you are in vehicle and teleport you with vehicle.
can you give it to me in the format i use?
Reply
#11

Quote:
Originally Posted by funky1234
Посмотреть сообщение
Thats perfectly fine, however, don't forget your brackets!

It SHOULD look like this:

pawn Код:
if (strcmp("/drift1", cmdtext, true, 10) == 0)
{//You missed this
    SetPlayerPos(playerid, 0.0, 0.0, 0.0); //Make sure you change the co-ordinates!
    SendClientMessage(playerid, COLOR_WHITE, "You're at drift 1!");
    return 1;
}//You also missed this!
Edit: Lorenc_ beat my slow internet connection
I know...;]I just did an example...
Reply
#12

pawn Код:
if (strcmp("/drift1", cmdtext, true, 10) == 0)
{
        new vehid = GetPlayerVehicleID(playerid);
        if(IsPlayerInAnyVehicle(playerid))
        {
        SetVehiclePos(vehid, 0.0, 0.0, 6.0);
        SetPlayerPos(playerid,0.0,0.0,6.0);
        }
        else
        SetPlayerPos(playerid,0.0,0.0,6.0);
        return 1;
}
It's not perfect, but enough good for you, change all three coordinates to yours.
Reply
#13

Hey steve_gibson. Actually, if you are using more drifts, i suggest you to make like this:
PHP код:
// Top of your script
#define NUMBER_OF_DRIFTS (3)
new const stock Float:Drift[NUMBER_OF_DRIFTS][3] =
{
    {
0.01.02.0},
    {
3.04.05.0},
    {
6.07.08.0}
}
// At top of OnPlayerCommandText
#if !defined string
    
new string[128];
#endif
for(new 0NUMBER_OF_DRIFTSi++)
{
    
format(stringsizeof(string), "/drift%d", (i+1));
    if(!
strcmp(cmdtextstringtrue))
    {
        if(
IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), Drift[i][0], Drift[i][1], Drift[i][2]);
        else 
SetPlayerPos(playeridDrift[i][0], Drift[i][1], Drift[i][2]);
    }

And let me explain how this works. If you type /drift1, he will get the coords from the Drift Array, from the line 0. If you type /drift2, he will get the coords from the Drift Array, from the line 1.

If you want to add more drifts, just change & add the coords in Drift Array and change the number of drifts from macro NUMBER_OF_DRIFTS.
Reply
#14

That's kinda hard if he can't create basic commands, yet...
Reply
#15

That's not so hard. If he wants to add more drifts, he must change ONLY the number from the macro NUMBER_OF_DRIFTS and to add / change coords at Drift Array.
Reply
#16

Mind searching next time?.
https://sampforum.blast.hk/showthread.php?tid=207028
Reply
#17

Quote:
Originally Posted by MoroDan
Посмотреть сообщение
Hey steve_gibson. Actually, if you are using more drifts, i suggest you to make like this:
PHP код:
// Top of your script
#define NUMBER_OF_DRIFTS (3)
new const stock Float:Drift[NUMBER_OF_DRIFTS][3] =
{
    {
0.01.02.0},
    {
3.04.05.0},
    {
6.07.08.0}
}
// At top of OnPlayerCommandText
#if !defined string
    
new string[128];
#endif
for(new 0NUMBER_OF_DRIFTSi++)
{
    
format(stringsizeof(string), "/drift%d", (i+1));
    if(!
strcmp(cmdtextstringtrue))
    {
        if(
IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), Drift[i][0], Drift[i][1], Drift[i][2]);
        else 
SetPlayerPos(playeridDrift[i][0], Drift[i][1], Drift[i][2]);
    }

And let me explain how this works. If you type /drift1, he will get the coords from the Drift Array, from the line 0. If you type /drift2, he will get the coords from the Drift Array, from the line 1.

If you want to add more drifts, just change & add the coords in Drift Array and change the number of drifts from macro NUMBER_OF_DRIFTS.
I understand i well...
Reply
#18

Quote:
Originally Posted by Kitten
Посмотреть сообщение
Thank you very nice work but i don't do this so i make a good server but iam looking to make some small projects to start learning.
Reply
#19

C:\Documents and Settings\steve\ЕрйцЬнейб есгбуЯбт\drifting\gamemodes\Untitled.pwn(4 : warning 202: number of arguments does not match definition
C:\Documents and Settings\steve\ЕрйцЬнейб есгбуЯбт\drifting\gamemodes\Untitled.pwn(49) : warning 202: number of arguments does not match definition
C:\Documents and Settings\steve\ЕрйцЬнейб есгбуЯбт\drifting\gamemodes\Untitled.pwn(50) : warning 202: number of arguments does not match definition
C:\Documents and Settings\steve\ЕрйцЬнейб есгбуЯбт\drifting\gamemodes\Untitled.pwn(57) : error 001: expected token: ";", but found "return"
C:\Documents and Settings\steve\ЕрйцЬнейб есгбуЯбт\drifting\gamemodes\Untitled.pwn(100) : warning 202: number of arguments does not match definition
C:\Documents and Settings\steve\ЕрйцЬнейб есгбуЯбт\drifting\gamemodes\Untitled.pwn(106) : warning 202: number of arguments does not match definition
C:\Documents and Settings\steve\ЕрйцЬнейб есгбуЯбт\drifting\gamemodes\Untitled.pwn(112) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.



POUUUFFF SOMEONE?
Reply
#20

Please post the code, else we can't see the problem.
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)