05.08.2011, 03:02
Hello, I just update my server package to R5 and re-compiled my game-mode.
On entering the server, commands don't seem to work correctly anymore, for example:
Displays the "Player is not connected or is not logged in" message when I try it on myself, what is this due to? Is the variable not being set anymore or something? Or is IsPlayerConnected failing?
On entering the server, commands don't seem to work correctly anymore, for example:
pawn Код:
CMD:givearms(playerid, params[])
{
if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
{
new weaponid, ammo, string[128], gun[30], playa;
if(sscanf(params, "uii", playa, weaponid, ammo)) return SendClientMessage(playerid, White, "USAGE: /givearms [playerID] [weaponID] [Ammo]");
if(weaponid > 46 || weaponid < 1) return SendClientMessage(playerid,Red,"Invalid Weapon ID!");
if(IsPlayerConnected(playa) && PlayerInfo[playa][LoggedIn])
{
GetWeaponName(weaponid,gun,30);
if(playa != playerid)
{
format(string,sizeof(string),"You gave %s a %s with %d rounds of ammunition!", pName(playa),gun, ammo); SendClientMessage(playerid,White,string);
format(string,sizeof(string),"You have recieved a %s with %d round of ammunition from Administrator %s",gun, ammo, pName(playerid)); SendClientMessage(playa, Green, string);
format(string,sizeof(string),"%s gave %s a %s with %d rounds of ammunition",pName(playerid),pName(playa),gun, ammo); MessageToAdmins(White, string);
return GivePlayerWeapon(playa, weaponid, ammo);
} else {
format(string,sizeof(string),"You gave yourself a %s with %d rounds of ammunition!", gun, ammo); SendClientMessage(playerid,White,string);
format(string,sizeof(string),"%s gave himself a %s with %d rounds of ammunition",pName(playerid),gun, ammo); MessageToAdmins(White, string);
return GivePlayerWeapon(playa, weaponid, ammo);
}
} else return SendClientMessage(playerid, Red,"Player is not connected or is not logged in!");
} else return 0;
}