adding commands - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: adding commands (
/showthread.php?tid=153493)
adding commands -
Abraham2nd - 09.06.2010
ok i have a class that gives player test for there license cmds are /startlesson . /stoplesson . /givelicense
and i want to add a /fail [id] [reason]
will show .. [Person names] has failed his/her license test.
please help its soo hard
Re: adding commands -
Joe_ - 09.06.2010
This is in ZCMD and SSCANF2
pawn Код:
CMD:fail(playerid, params[])
{
new name[MAX_PLAYER_NAME], id, reason;
if(sscanf(params, "us", id, reason)) return SendClientMessage(playerid, color, "Usage: /fail <Name/id> <Reason>");
GetPlayerName(id, name, sizeof(name));
format(string,sizeof(string),"%s Has failed his/her license test.", name);
SendClientMessageToAll(color, string);
return 1;
}
That's a basic form, you will want to check if the playerid is a instructor, and if id is in a lesson.
example
pawn Код:
//lesson
if(!IsInLesson[id]) SendClientMessage(playerid, color, "Error: that player is not in a lesson.");
//instructor
if(pData[playerid][Job] != INSTRUCTOR) SendClientMessage(playerid, color, "Error: You are not an instructor");
Ofcourse you would have to make your own array for the instructor and IsInLesson.
Re: adding commands -
Abraham2nd - 09.06.2010
Quote:
Originally Posted by Joe_
This is in ZCMD and SSCANF2
pawn Код:
CMD:fail(playerid, params[]) { new name[MAX_PLAYER_NAME], id, reason; if(sscanf(params, "us", id, reason)) return SendClientMessage(playerid, color, "Usage: /fail <Name/id> <Reason>"); GetPlayerName(id, name, sizeof(name)); format(string,sizeof(string),"%s Has failed his/her license test.", name); SendClientMessageToAll(color, string); return 1; }
That's a basic form, you will want to check if the playerid is a instructor, and if id is in a lesson.
example
pawn Код:
//lesson if(!IsInLesson[id]) SendClientMessage(playerid, color, "Error: that player is not in a lesson.");
//instructor if(pData[playerid][Job] != INSTRUCTOR) SendClientMessage(playerid, color, "Error: You are not an instructor");
Ofcourse you would have to make your own array for the instructor and IsInLesson.
|
i get this error
Код:
C:\Documents and Settings\Abraham2\My Documents\SAMP SERVERS\ser 0.3\gamemodes\larp.pwn(67613) : error 010: invalid function or declaration
C:\Documents and Settings\Abraham2\My Documents\SAMP SERVERS\ser 0.3\gamemodes\larp.pwn(72752) : warning 203: symbol is never used: "fail"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: adding commands -
Naxix - 09.06.2010
Show us the line for the first error..
And the second error is that you added something like "new fail;" at the top of your script and you don't use it anywhere.
Re: adding commands -
Abraham2nd - 09.06.2010
Quote:
Originally Posted by Naxix
Show us the line for the first error..
And the second error is that you added something like "new fail;" at the top of your script and you don't use it anywhere.
|
its return 1;
Re: adding commands -
Naxix - 09.06.2010
I'm not sure if this will fix it, but i can't see you adding the string anywhere? So your formating and sending a string that don't exsist?
Re: adding commands -
Abraham2nd - 09.06.2010
Quote:
Originally Posted by Naxix
I'm not sure if this will fix it, but i can't see you adding the string anywhere? So your formating and sending a string that don't exsist?
|
well what string shall i put
Re: adding commands -
Naxix - 09.06.2010
around "new string[40];"
Re: adding commands -
Abraham2nd - 10.06.2010
Quote:
Originally Posted by Naxix
around "new string[40];"
|
i did it and it comply good but now..i went in game used the cmd /fail and nothing
it said unknown command