Posts: 156
Threads: 25
Joined: May 2016
I would to make a stock or callback that
PHP код:
If(PlayerInfo[playerid][pAdmin] == 1)
{
format(string,sizeof(string), "Junior Admin");
}
So when i make /adminchat cmd i don't need to make multiple if / else statements.
Is this possible, Thanks!
Posts: 156
Threads: 25
Joined: May 2016
Quote:
Originally Posted by Vince
There is no such thing as "a stock". Their is something called a stock function but what you're looking for is a normal function. A stock function in its most pure sense is a function that can be copied into any script without any alterations. That concludes the speech for misuse of the stock keyword.
Anyway, what I would do is create an array of titles and then simply select the right value by using the rank as the index.
PHP код:
GetLevelTitle(level)
{
static const gAdminTitles[][] = {
"None", // 0
"Junior Admin", // 1
"Admin", // 2
"Senior Admin" // 3
};
return gAdminTitles[level];
}
|
Thanks bro, But i got this error
Код:
C:\Users\user\Desktop\lewl\gamemodes\lewl.pwn(2345) : error 010: invalid function or declaration
C:\Users\user\Desktop\lewl\gamemodes\lewl.pwn(2345 -- 2356) : error 010: invalid function or declaration
PHP код:
GetLevelTitle(level)
{
static const gAdminTitles[][] = {
"None", // 0
"Black-Listed", // 1
"Junior Admin", // 2
"General Admin" // 3
"Senior Admin"
"Head Admin"
"Server Manager"
};
return gAdminTitles[level];
}
Posts: 156
Threads: 25
Joined: May 2016
Quote:
Originally Posted by Micko123
PHP код:
GetLevelTitle(level)
{
static const gAdminTitles[][] = {
"None", // 0
"Black-Listed", // 1
"Junior Admin", // 2
"General Admin",// 3
"Senior Admin",
"Head Admin",
"Server Manager"
};
return gAdminTitles[level];
}
|
Thanks now i got this error when i tried to call the function on my /a cmd
C:\Users\user\Desktop\lewl Roleplay\gamemodes\lewl.pwn(36082) : error 017: undefined symbol "level"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Line:
Quote:
format(szMessage, sizeof(szMessage), "* %s %s: %s", GetLevelTitle(level), GetPlayerNameEx(playerid), params);
|
Full Code
PHP код:
CMD:admin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1) {
if(!isnull(params))
{
new szMessage[128];
format(szMessage, sizeof(szMessage), "* %s %s: %s", GetLevelTitle(level), GetPlayerNameEx(playerid), params);
}
else SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/a)dmin [admin chat]");
}
return 1;
}
Posts: 156
Threads: 25
Joined: May 2016
Quote:
Originally Posted by Micko123
try by doing this
PHP код:
CMD:admin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1) {
if(!isnull(params))
{
new szMessage[128], level[50];
format(szMessage, sizeof(szMessage), "* %s %s: %s", GetLevelTitle(level), GetPlayerNameEx(playerid), params);
}
else SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/a)dmin [admin chat]");
}
return 1;
}
|
PHP код:
C:\Users\user\Desktop\Ssa Roleplay\gamemodes\asm.pwn(36083) : error 035: argument type mismatch (argument 1)
Quote:
format(szMessage, sizeof(szMessage), "* %s %s: %s", GetLevelTitle(level), GetPlayerNameEx(playerid), params);
|
Posts: 694
Threads: 2
Joined: Oct 2012
Reputation:
0
Do you even pawn brah? From what I see you either have 0 intention of learning, or are a newbie that is trying to learn in the worst and hardest way.
Copy pasting things all over a text editor won't make a gamemode, read some tutorials, learn a bit about writing codes then start this.
And seriously how people started calling functions stocks? why can't we see same people calling variables "news"?
Posts: 156
Threads: 25
Joined: May 2016
Quote:
Originally Posted by Micko123
Try this
Код:
format(szMessage, sizeof(szMessage), "* %s %s: %s", GetLevelTitle(level), GetPlayerNameEx(playerid));
|
Does'nt help i still get the error