Creating a command "//" - 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: Creating a command "//" (
/showthread.php?tid=532067)
Creating a command "//" -
siemka321 - 16.08.2014
Is it possible to create a command using ZCMD, and it is: "// <text>"?
Whenever I try creating it, it get a ton of errors.
Here's my script:
Код:
COMMAND:/(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
if(!isnull(params))
{
new string[128],vardas[MAX_PLAYER_NAME];
GetPlayerName(playerid,vardas,sizeof(vardas));
format(string,sizeof(string),"%s: %s",vardas,params);
for (new i = 0; i != MAX_PLAYERS; ++i)
{
if(PlayerInfo[i][pAdmin] >= 2) SendClientMessage(i,COLOR_YELLOW, string);
}
}
else return SendClientMessage(playerid, COLOR_CORAL, "Naudojimas /ac <tekstas>");
}
else
{
SendClientMessage(playerid,COLOR_WHITE,"Tokios komandos nлra. Norint suюinoti daugiau, raрykite: {00FF00}/pagalba");
}
return 1;
}
Re: Creating a command "//" -
Chilli9434 - 16.08.2014
Would it be possible to show these errors?
Re: Creating a command "//" -
siemka321 - 16.08.2014
Код:
C:\pawno\include\sscanf2.inc(218) : warning 219: local variable "string" shadows a variable at a preceding level
C:\pawno\include\sscanf2.inc(218) : warning 219: local variable "string" shadows a variable at a preceding level
C:\pawno\include\sscanf2.inc(278) : warning 219: local variable "string" shadows a variable at a preceding level
C:\pawno\include\sscanf2.inc(278) : warning 219: local variable "string" shadows a variable at a preceding level
C:\pawno\include\dutils.inc(28) : warning 219: local variable "string" shadows a variable at a preceding level
C:\pawno\include\dutils.inc(132) : warning 219: local variable "string" shadows a variable at a preceding level
C:\pawno\include\dutils.inc(172) : warning 219: local variable "string" shadows a variable at a preceding level
C:\pawno\include\dutils.inc(280) : warning 219: local variable "string" shadows a variable at a preceding level
C:\pawno\include\dutils.inc(337) : warning 219: local variable "string" shadows a variable at a preceding level
C:\pawno\include\dutils.inc(379) : warning 219: local variable "string" shadows a variable at a preceding level
C:\pawno\include\dini.inc(239) : warning 219: local variable "string" shadows a variable at a preceding level
C:\pawno\include\YSI\y_utils.inc(343) : warning 219: local variable "string" shadows a variable at a preceding level
C:\pawno\include\YSI\y_utils.inc(497) : warning 219: local variable "string" shadows a variable at a preceding level
C:\pawno\include\YSI\y_utils.inc(540) : warning 219: local variable "string" shadows a variable at a preceding level
C:\pawno\include\YSI\y_utils.inc(558) : warning 219: local variable "string" shadows a variable at a preceding level
C:\pawno\include\YSI\y_malloc.inc(216) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(401) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(2579) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(2613) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(2688) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(2705) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(2723) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(3050) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(3191) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(3294) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(3313) : error 001: expected token: "(", but found "/"
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(3313) : error 001: expected token: ";", but found "("
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(3315) : error 010: invalid function or declaration
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(3317) : error 010: invalid function or declaration
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(3320) : error 021: symbol already defined: "GetPlayerName"
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(3322) : error 010: invalid function or declaration
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(3324) : error 010: invalid function or declaration
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(3327) : error 010: invalid function or declaration
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(3329) : error 010: invalid function or declaration
C:\Users\Simas\Desktop\0.3z NLK\gamemodes\NLK2.pwn(3333) : error 010: invalid function or declaration
Re: Creating a command "//" -
Djole1337 - 16.08.2014
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[]) {
if (cmdtext[0] == '/' && cmdtext[1] == '/') {
// do stuff
}
}