Useful Commands -
[HK]Ryder[AN] - 29.10.2012
Hello Guys,
I was thinking that there is a Useful Functions and Useful Snippets topic so why not create a Useful Commands topic.
Then i saw a thread where a guy asked if there was a Useful Commands topic.
I got permission to create this thread from ****** so here it is.
Heres a simple /goto and /bring command required in many servers.
pawn Код:
if ( strcmp( cmd, "/goto", true ) == 0 )
{
new tmp[256];
tmp = strtok( cmdtext, idx );
if ( !strlen( tmp ) ) { return 1; }
new Float:X, Float:Y, Float:Z;
if ( GetPlayerVehicleID( playerid ) )
{
GetPlayerPos( strval(tmp), X, Y, Z );
SetVehiclePos( GetPlayerVehicleID(playerid), X+2, Y+2, Z );
} else {
GetPlayerPos( strval(tmp), X, Y, Z );
SetPlayerPos( playerid, X+2, Y+2, Z );
}
return 1;
}
if ( strcmp( cmd, "/bring", true ) == 0 )
{
new tmp[256];
tmp = strtok( cmdtext, idx );
if ( !strlen( tmp ) ) { return 1; }
new Float:X, Float:Y, Float:Z;
if ( GetPlayerVehicleID( strval(tmp) ) )
{
GetPlayerPos( playerid, X, Y, Z );
SetVehiclePos( GetPlayerVehicleID(strval(tmp)), X+2, Y+2, Z );
} else {
GetPlayerPos( playerid, X, Y, Z );
SetPlayerPos( strval(tmp), X+2, Y+2, Z );
}
return 1;
}
Re: Useful Commands -
Luis- - 29.10.2012
Why not use ZCMD instead? Strcmp is old and shit.
Re: Useful Commands -
Lordzy - 29.10.2012
Why another topic when 'Useful Snippets' exist? Users do post commands on Useful Snippets so I don't feel another topic has to be created..
Re: Useful Commands -
Abhishek. - 29.10.2012
well to use this you need to have ZCMD include and scccanf
pawn Код:
COMMAND:acar(playerid,params[])
{
new Float:_X_,Float:_Y_,Float:_Z_,veh,color1,color2;
GetPlayerPos(playerid,_X_,_Y_,_Z_);
if (!sscanf(params, "iii", veh, color1,color2))
{
AddStaticVehicle(veh,_X_,_Y_,_Z_,0,color1, color2);
}
else SendClientMessage(playerid, COLOR_ERROR, "Usage: /veh [carid] [Color 1] [Color 2]");
return 1;
}
Re: Useful Commands -
[HK]Ryder[AN] - 29.10.2012
Quote:
Originally Posted by -Luis
Why not use ZCMD instead? Strcmp is old and shit.
|
You can add commands in replies made of ZCMD. this is just the start
Quote:
Originally Posted by Lordz™
Why another topic when 'Useful Snippets' exist? Users do post commands on Useful Snippets so I don't feel another topic has to be created..
|
Maybe, but all people don't think that, and a seperate topic for cmds might be nice.
Quote:
Originally Posted by [bot]fatninja
well to use this you need to have ZCMD include and scccanf
pawn Код:
COMMAND:acar(playerid,params[]) { new Float:_X_,Float:_Y_,Float:_Z_,veh,color1,color2; GetPlayerPos(playerid,_X_,_Y_,_Z_); if (!sscanf(params, "iii", veh, color1,color2)) { AddStaticVehicle(veh,_X_,_Y_,_Z_,0,color1, color2); } else SendClientMessage(playerid, COLOR_ERROR, "Usage: /veh [carid] [Color 1] [Color 2]"); return 1; }
|
Thanks for posting something..
Waiting for ****** to sticky it.
Re: Useful Commands -
[D]ry[D]esert - 29.10.2012
here to to dissable chat
on the top of your script
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/chat", true))
{
if(IsPlayerAdmin(playerid))
{
if(Chat == 0)
{
Chat = 1;
SendClientMessage(playerid, 0xFFFFFFFF, "chat enabled");
}
if(Chat == 1)
{
Chat = 0;
SendClientMessage(playerid, 0xFFFFFFFF, "chat disable");
}
}
}
return 0;
}
pawn Код:
public OnPlayerText(playerid, text[])
{
if(Chat == 0) return 0;
}
Re: Useful Commands -
Abhishek. - 29.10.2012
Quote:
Originally Posted by [D]ry[D]esert
here to to dissable chat
on the top of your script
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp(cmdtext, "/chat", true)) { if(IsPlayerAdmin(playerid)) { if(Chat == 0) { Chat = 1; SendClientMessage(playerid, 0xFFFFFFFF, "chat enabled"); } if(Chat == 1) { Chat = 0; SendClientMessage(playerid, 0xFFFFFFFF, "chat disable"); } } } return 0; }
pawn Код:
public OnPlayerText(playerid, text[]) { if(Chat == 0) return 0; }
|
Dont mind but usefull commands are diffrent from usefull codes or TUT of doing something
Re: Useful Commands -
[D]ry[D]esert - 29.10.2012
Quote:
Originally Posted by [bot]fatninja
Dont mind but usefull commands are diffrent from usefull codes or TUT of doing something
|
okey sir.