22.02.2011, 13:30
Hi. I have found out how to make a basic admin command with MySQL but I cannot figure out how to make an if-function where I ask whether the player typing the command is admin or not and then depending on what the playerinfo shows for the player he succeeds making the other player admin or not. I tried to use GetPVarInt but with no success.
To sum this up; I basically need to know how to receive information from the MySQL database.
This is how far I have got:
As you can see it's not really finished yet.
I also would like to ask, how can I instead of directly setting the adminlevel to 1 set it to whatever the admin chooses to set it to?
Example: /makeadmin 1 3
Explaination: [Command] [ID] [Level]
Thank you!
To sum this up; I basically need to know how to receive information from the MySQL database.
This is how far I have got:
pawn Код:
COMMAND:makeadmin(playerid, params[]) //using ZCMD this is how your command will start off looking like.
{
if(GetPVarInt(playerid, "Adminlevel" == 1) // gives me errors, obviously something wrong
{
new otherplayerid;
if(sscanf(params, "ui", otherplayerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "/makeadmin [playerid/name] [adminlevel]");
else if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "This player is not connected");
else
{
SendClientMessage(otherplayerid,0xFFFFFFFF,"An admin has set you as administrator.");
SetPVarInt(otherplayerid, "Adminlevel", 1);
SendClientMessage(playerid, 0xFFFFFFFF, "You have given someone administrator rights.");
}
}
return 1;
}
I also would like to ask, how can I instead of directly setting the adminlevel to 1 set it to whatever the admin chooses to set it to?
Example: /makeadmin 1 3
Explaination: [Command] [ID] [Level]
Thank you!