Simple cmds. -
steve_gibson - 16.07.2011
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,
Re: Simple cmds. -
freshOrange - 16.07.2011
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;
}
Re: Simple cmds. -
steve_gibson - 16.07.2011
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?
Re: Simple cmds. -
freshOrange - 16.07.2011
Give us coordinates where to teleport.
Re: Simple cmds. -
Lorenc_ - 16.07.2011
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;
}
Re: Simple cmds. -
Kitten - 16.07.2011
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?.
Re: Simple cmds. -
steve_gibson - 16.07.2011
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;
Re: Simple cmds. -
Lorenc_ - 16.07.2011
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!
Re: Simple cmds. -
Ash. - 16.07.2011
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
Re: Simple cmds. -
steve_gibson - 16.07.2011
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?
Re: Simple cmds. -
steve_gibson - 16.07.2011
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...
Re: Simple cmds. -
freshOrange - 16.07.2011
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.
Re: Simple cmds. -
MoroDan - 16.07.2011
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.0, 1.0, 2.0},
{3.0, 4.0, 5.0},
{6.0, 7.0, 8.0}
}
// At top of OnPlayerCommandText
#if !defined string
new string[128];
#endif
for(new i = 0; i < NUMBER_OF_DRIFTS; i++)
{
format(string, sizeof(string), "/drift%d", (i+1));
if(!strcmp(cmdtext, string, true))
{
if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), Drift[i][0], Drift[i][1], Drift[i][2]);
else SetPlayerPos(playerid, Drift[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.
Re: Simple cmds. -
freshOrange - 16.07.2011
That's kinda hard if he can't create basic commands, yet...
Re: Simple cmds. -
MoroDan - 16.07.2011
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.
Re: Simple cmds. -
Kitten - 16.07.2011
Mind searching next time?.
https://sampforum.blast.hk/showthread.php?tid=207028
Re: Simple cmds. -
steve_gibson - 16.07.2011
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.0, 1.0, 2.0},
{3.0, 4.0, 5.0},
{6.0, 7.0, 8.0}
}
// At top of OnPlayerCommandText
#if !defined string
new string[128];
#endif
for(new i = 0; i < NUMBER_OF_DRIFTS; i++)
{
format(string, sizeof(string), "/drift%d", (i+1));
if(!strcmp(cmdtext, string, true))
{
if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), Drift[i][0], Drift[i][1], Drift[i][2]);
else SetPlayerPos(playerid, Drift[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...
Re: Simple cmds. -
steve_gibson - 16.07.2011
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.
Re: Simple cmds. -
steve_gibson - 16.07.2011
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?
Re: Simple cmds. -
freshOrange - 16.07.2011
Please post the code, else we can't see the problem.