27.09.2013, 22:14
Hey People,
Just noticed this command doesn't work, but I don't see an issue?
Does the X_NR need to classed as params? and then "u", on sscanf, and ignore the x_nr?
Just noticed this command doesn't work, but I don't see an issue?
pawn Код:
CMD:agl(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 2)
{
new string[256], giveplayerid, x_nr[24];
if(sscanf(params, "s[60]", x_nr))
{
SCM(playerid, COLOR_WHITE, "USAGE: /agl [name] [playerid/PartOfName]");
SCM(playerid, COLOR_WHITE, "Available names: Driving, Flying, Sailing, Fishing, Weapon.");
return 1;
}
if(strcmp(x_nr,"flying",true) == 0)
{
if(sscanf(params, "u", giveplayerid))
{
SCM(playerid, COLOR_WHITE, "USAGE: /agl Flying [playerid/PartOfName]");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PlayerInfo[giveplayerid][pPassport] == 1)
{
format(string, sizeof(string), "* You've given a Flying License to %s (%d).",GetPlayerNameEx(giveplayerid), giveplayerid);
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has given you a Flying License.",GetPlayerNameEx(playerid));
SCM(giveplayerid, COLOR_LIGHTBLUE, string);
PlayerInfo[giveplayerid][pFlyLic] = 1;
format(string, sizeof(string), "AdmCmd: %s Has Given a Flying License to %s (%d).",GetPlayerNameEx(playerid) ,GetPlayerNameEx(giveplayerid), giveplayerid);
ABroadCast(COLOR_LIGHTRED, string, 5);
return 1;
}
else
{
SCM(playerid, COLOR_GREY, " That player doesn't has a passport!");
return 1;
}
}
}
else
{
SCM(playerid, COLOR_GREY, " That player is Offline!");
return 1;
}
}
else if(strcmp(x_nr,"sailing",true) == 0)
{
if(sscanf(params, "u", giveplayerid))
{
SCM(playerid, COLOR_WHITE, "USAGE: /agl sailinglicense [playerid/PartOfName]");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
format(string, sizeof(string), "* You've given a Sailing License to %s (%d).",GetPlayerNameEx(giveplayerid), giveplayerid);
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Admin %s has given you a Sailing License.",GetPlayerNameEx(playerid));
SCM(giveplayerid, COLOR_LIGHTBLUE, string);
PlayerInfo[giveplayerid][pBoatLic] = 1;
format(string, sizeof(string), "AdmCmd: %s Has Given a Sailing License to %s (%d).",GetPlayerNameEx(playerid) ,GetPlayerNameEx(giveplayerid), giveplayerid);
ABroadCast(COLOR_LIGHTRED, string, 5);
return 1;
}
}
else
{
SCM(playerid, COLOR_GREY, " That player is Offline!");
return 1;
}
}
else if(strcmp(x_nr,"driving",true) == 0)
{
if(sscanf(params, "u", giveplayerid))
{
SCM(playerid, COLOR_WHITE, "USAGE: /agl Driverslicense [playerid/PartOfName]");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PlayerInfo[giveplayerid][pPassport] == 1)
{
format(string, sizeof(string), "* You've given a Driving License to %s (%d).",GetPlayerNameEx(giveplayerid), giveplayerid);
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Admin %s has given you a Driving License.",GetPlayerNameEx(playerid));
SCM(giveplayerid, COLOR_LIGHTBLUE, string);
PlayerInfo[giveplayerid][pCarLic] = 1;
format(string, sizeof(string), "AdmCmd: %s Has Given a Driving License to %s (%d).",GetPlayerNameEx(playerid) ,GetPlayerNameEx(giveplayerid), giveplayerid);
ABroadCast(COLOR_LIGHTRED, string, 5);
return 1;
}
else
{
SCM(playerid, COLOR_GREY, "This player hasn't a passport!");
return 1;
}
}
}
else
{
SCM(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
else if(strcmp(x_nr,"fishing",true) == 0)
{
if(sscanf(params, "u", giveplayerid))
{
SCM(playerid, COLOR_WHITE, "USAGE: /agl fishinglicense [playerid/PartOfName]");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
format(string, sizeof(string), "* You've given a Fishing License to %s (%d).",GetPlayerNameEx(giveplayerid), giveplayerid);
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Admin %s has given you a Fishing License.",GetPlayerNameEx(playerid));
SCM(giveplayerid, COLOR_LIGHTBLUE, string);
PlayerInfo[giveplayerid][pFishLic] = 1;
format(string, sizeof(string), "AdmCmd: %s Has Given a Fishing License to %s (%d).",GetPlayerNameEx(playerid) ,GetPlayerNameEx(giveplayerid), giveplayerid);
ABroadCast(COLOR_LIGHTRED, string, 5);
return 1;
}
}
else
{
SCM(playerid, COLOR_GREY, " That player is Offline!");
return 1;
}
}
else if(strcmp(x_nr,"weapon",true) == 0)
{
if(sscanf(params, "u", giveplayerid))
{
SCM(playerid, COLOR_WHITE, "USAGE: /agl weaponlicense [playerid/PartOfName]");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
format(string, sizeof(string), "* You've given a Weapon License to %s (%d).",GetPlayerNameEx(giveplayerid), giveplayerid);
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Admin %s has given you a Weapon License.",GetPlayerNameEx(playerid));
SCM(giveplayerid, COLOR_LIGHTBLUE, string);
PlayerInfo[giveplayerid][pGunLic] = 1;
format(string, sizeof(string), "AdmCmd: %s Has Given a Weapon License to %s (%d).",GetPlayerNameEx(playerid) ,GetPlayerNameEx(giveplayerid), giveplayerid);
ABroadCast(COLOR_LIGHTRED, string, 5);
return 1;
}
}
else
{
SCM(playerid, COLOR_GREY, " That player is Offline!");
return 1;
}
}
}
else
{
SCM(playerid, COLOR_GREY, " You are not authorised to use this command!");
return 1;
}
}
return 1;
}