SetVIP problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetVIP problem (
/showthread.php?tid=272279)
SetVIP problem -
Shockey HD - 27.07.2011
Here is my Setvip code that i personally made
PHP код:
CMD:setVIP(playerid, params[])
{
new victimname[MAX_PLAYER_NAME], vipname[MAX_PLAYER_NAME], viplvl, id;
if(IsPlayerAdmin(playerid))
{
if (sscanf(params, "ui", id, viplvl)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setvip [id] [viplevel]");
if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "System: Invalid ID");
if (viplvl <= 3 && viplvl >= 0) return SendClientMessage(playerid, COLOR_RED,"System: Valid vip Levels: 1-3!");
PlayerInfo[id][pVipLevel] = viplvl;
GetPlayerName(id, victimname, sizeof(victimname));
GetPlayerName(playerid, vipname, sizeof(vipname));
new str[128];
format(str,128,"System: %s [ID %d] has set %s [ID %d] admin level to %i",vipname, playerid, victimname, id, viplvl);
SendClientMessage(playerid,COLOR_GREEN,str);
return 1;
}
else return SendClientMessage(playerid,COLOR_RED," You are not allowed to use this command!");
}
So here's the problem, It doesn't work. None if the
if(PlayerInfo[playerid][pVipLevel] >= 3) work and when i type /setvip i got a response of Unknown Server Command. Whats the problem?
Re: SetVIP problem -
Burridge - 27.07.2011
You need to return 1 on the command itself.
pawn Код:
CMD:setVIP(playerid, params[])
{
new victimname[MAX_PLAYER_NAME], vipname[MAX_PLAYER_NAME], viplvl, id;
if(IsPlayerAdmin(playerid))
{
if (sscanf(params, "ui", id, viplvl)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setvip [id] [viplevel]");
if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "System: Invalid ID");
if (viplvl <= 3 && viplvl >= 0) return SendClientMessage(playerid, COLOR_RED,"System: Valid vip Levels: 1-3!");
PlayerInfo[id][pVipLevel] = viplvl;
GetPlayerName(id, victimname, sizeof(victimname));
GetPlayerName(playerid, vipname, sizeof(vipname));
new str[128];
format(str,128,"System: %s [ID %d] has set %s [ID %d] admin level to %i",vipname, playerid, victimname, id, viplvl);
SendClientMessage(playerid,COLOR_GREEN,str);
return 1;
}
else return SendClientMessage(playerid,COLOR_RED," You are not allowed to use this command!");
return 1;
}
Re: SetVIP problem -
Shockey HD - 27.07.2011
PHP код:
else return SendClientMessage(playerid,COLOR_RED," You are not allowed to use this command!");
return 1;
}
The return 1; gives me a Unreachable code
Re: SetVIP problem -
PrawkC - 27.07.2011
pawn Код:
CMD:setVIP(playerid, params[])
{
new victimname[MAX_PLAYER_NAME], vipname[MAX_PLAYER_NAME], viplvl, id;
if(IsPlayerAdmin(playerid))
{
if (sscanf(params, "ui", id, viplvl)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setvip [id] [viplevel]");
if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "System: Invalid ID");
if (viplvl > 3 || viplvl < 1) return SendClientMessage(playerid, COLOR_RED,"System: Valid vip Levels: 1-3!");
PlayerInfo[id][pVipLevel] = viplvl;
GetPlayerName(id, victimname, sizeof(victimname));
GetPlayerName(playerid, vipname, sizeof(vipname));
new str[128];
format(str,128,"System: %s [ID %d] has set %s [ID %d] admin level to %i",vipname, playerid, victimname, id, viplvl);
SendClientMessage(playerid,COLOR_GREEN,str);
return 1;
}
else SendClientMessage(playerid,COLOR_RED," You are not allowed to use this command!");
return 1;
}
Re: SetVIP problem -
Burridge - 27.07.2011
Try removing the return 1 from
pawn Код:
SendClientMessage(playerid,COLOR_GREEN,str);
return 1;
Re: SetVIP problem -
Shockey HD - 27.07.2011
Nope, still didnt work
Re: SetVIP problem -
PrawkC - 27.07.2011
Quote:
Originally Posted by Shockey HD
Nope, still didnt work
|
Did you try what I said ?
Re: SetVIP problem -
Shockey HD - 27.07.2011
Quote:
Originally Posted by PrawkC
Did you try what I said ?
|
Yea i found the problem /setVIP need to be /setvip No capitals are allowed