adding commands
#1

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
Reply
#2

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.
Reply
#3

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.
Reply
#4

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.
Reply
#5

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;
Reply
#6

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?
Reply
#7

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
Reply
#8

around "new string[40];"
Reply
#9

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)