Help with command
#1

Hey, i need help about command, i got lockers, of the factions and i want change it to /locker for every one

so i did it

Код:
CMD:locker(playerid, params[]) return cmd_lspd(playerid, params);
CMD:locker(playerid, params[]) return cmd_fbi(playerid, params);
CMD:locker(playerid, params[]) return cmd_lsfmd(playerid, params);
CMD:locker(playerid, params[]) return cmd_govl(playerid, params);
and thats giving me error:
Код:
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(8827) : warning 217: loose indentation
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(10163) : warning 217: loose indentation
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(10179) : warning 225: unreachable code
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(10422) : warning 219: local variable "gun" shadows a variable at a preceding level
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(24502) : error 021: symbol already defined: "cmd_locker"
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(24503) : error 021: symbol already defined: "cmd_locker"
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(24504) : error 021: symbol already defined: "cmd_locker"
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(42253) : warning 202: number of arguments does not match definition
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(42748) : warning 217: loose indentation
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(42869) : warning 217: loose indentation
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(43920) : warning 217: loose indentation
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(44629) : warning 217: loose indentation
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(64036) : warning 203: symbol is never used: "gun"
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(64036) : warning 203: symbol is never used: "gun2"
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(64036) : warning 203: symbol is never used: "gun3"
C:\Users\user\Desktop\org\scr\script\gamemodes\NBGv1.0.9.2.pwn(64036) : warning 203: symbol is never used: "prize"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
someone know what i am supposed to do?
Reply
#2

You can't just do that. You can't define locker multiple times. Do it like this,

pawn Код:
CMD:locker(playerid, params[])
{
if(PlayerInfo[playerid][pFaction] == FACTION_LSPD) return cmd_lspd(playerid, params);
else if(PlayerInfo[playerid][pFaction] == FACTION_FBI) return cmd_fbi(playerid, params);
else if(PlayerInfo[playerid][pFaction] == FACTION_LSFMD) return cmd_lsfmd(playerid, params);
else if(PlayerInfo[playerid][pFaction] == FACTION_GOV) return cmd_govl(playerid, params);
return 1;
}
or using switch,

pawn Код:
CMD:locker(playerid, params[])
{
switch(PlayerInfo[playerid][pFaction) {
case FACTION_LSPD: return cmd_lspd(playerid, params);
case FACTION_FBI: return cmd_fbi(playerid, params);
case FACTION_LSFMD: return cmd_lsfmd(playerid, params);
case FACTION_GOV: return cmd_govl(playerid, params);
default: return 0;
}
return 0;
}
Reply
#3

Quote:
Originally Posted by Abagail
Посмотреть сообщение
You can't just do that. You can't define locker multiple times. Do it like this,

pawn Код:
CMD:locker(playerid, params[])
{
if(PlayerInfo[playerid][pFaction] == FACTION_LSPD) return cmd_lspd(playerid, params);
else if(PlayerInfo[playerid][pFaction] == FACTION_FBI) return cmd_fbi(playerid, params);
else if(PlayerInfo[playerid][pFaction] == FACTION_LSFMD) return cmd_lsfmd(playerid, params);
else if(PlayerInfo[playerid][pFaction] == FACTION_GOV) return cmd_govl(playerid, params);
return 1;
}
or using switch,

pawn Код:
CMD:locker(playerid, params[])
{
switch(PlayerInfo[playerid][pFaction) {
case FACTION_LSPD: return cmd_lspd(playerid, params);
case FACTION_FBI: return cmd_fbi(playerid, params);
case FACTION_LSFMD: return cmd_lsfmd(playerid, params);
case FACTION_GOV: return cmd_govl(playerid, params);
default: return 0;
}
return 0;
}
thank you very much !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)