Police & Trucker Channels -
NathNathii - 07.04.2013
I tried to create a Police and Trucker channels, but when I compile the gamemode I get errors.
Remember I'm new into this.
Line 23 is nothing just to notice that.
Errors
Код:
C:\Users\Documents\GT Testing\pawno\include\PlayerCommands.inc(12) : error 017: undefined symbol "ClassTrucker"
C:\Users\Documents\GT Testing\pawno\include\PlayerCommands.inc(16) : error 079: inconsistent return types (array & non-array)
C:\Users\Documents\GT Testing\pawno\include\PlayerCommands.inc(20) : error 079: inconsistent return types (array & non-array)
C:\Users\Documents\GT Testing\pawno\include\PlayerCommands.inc(23) : warning 225: unreachable code
C:\Users\Documents\GT Testing\pawno\include\PlayerCommands.inc(23) : warning 217: loose indentation
C:\Users\Documents\GT Testing\pawno\include\PlayerCommands.inc(23) : error 029: invalid expression, assumed zero
C:\Users\Documents\GT Testing\pawno\include\PlayerCommands.inc(23) : error 017: undefined symbol "cmd_pr"
C:\Users\Documents\GT Testing\pawno\include\PlayerCommands.inc(23) : error 029: invalid expression, assumed zero
C:\Users\Documents\GT Testing\pawno\include\PlayerCommands.inc(23) : fatal error 107: too many error messages on one line
Trucker Channel
pawn Код:
CMD:tr(playerid, params[])
{
if (APlayerData[playerid][LoggedIn] == true)
if (APlayerData[playerid][PlayerClass] == ClassTrucker)
SendAdminText(playerid, "/tr", params);
new string[256], pName[MAX_PLAYER_NAME];
{
if(isnull(params)) return SendClientMessage(playerid, 0xFFFFFF, "/tr [message]");
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "{1B9FE0}(Trucker Channel)%s: %s", pName, params);
SendClientMessageToAll(0xFFFFFFF, string);
return 1;
}
Police Channel
pawn Код:
CMD:pr(playerid, params[])
{
if (APlayerData[playerid][LoggedIn] == true)
if (APlayerData[playerid][PlayerClass] == ClassPolice)
SendAdminText(playerid, "/pr", params);
new string[256], pName[MAX_PLAYER_NAME];
{
if(isnull(params)) return SendClientMessage(playerid, 0xFFFFFF, "/pr [message]");
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "{1B9FE0}(Police Channel)%s: %s", pName, params);
SendClientMessageToAll(0xFFFFFFF, string);
return 1;
}
Re: Police & Trucker Channels -
Kitten - 07.04.2013
error 017: undefined symbol "ClassTrucker"
It tells you whats your mistake define ClassTrucker.
Which lines are 16 and 20
Seems like your missing a bracket?
Try these two codes
pawn Код:
CMD:tr(playerid, params[])
{
new string[256], pName[MAX_PLAYER_NAME];
if (APlayerData[playerid][LoggedIn] == true)
{
if (APlayerData[playerid][PlayerClass] == ClassTrucker)
{
if(isnull(params)) return SendClientMessage(playerid, 0xFFFFFF, "/tr [message]");
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "{1B9FE0}(Trucker Channel)%s: %s", pName, params);
SendClientMessageToAll(0xFFFFFFF, string);
SendAdminText(playerid, "/tr", params);
}
}
return 1;
}
CMD:pr(playerid, params[])
{
new string[256], pName[MAX_PLAYER_NAME];
if (APlayerData[playerid][LoggedIn] == true)
{
if (APlayerData[playerid][PlayerClass] == ClassPolice)
{
if(isnull(params)) return SendClientMessage(playerid, 0xFFFFFF, "/pr [message]");
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "{1B9FE0}(Police Channel)%s: %s", pName, params);
SendClientMessageToAll(0xFFFFFFF, string);
SendAdminText(playerid, "/pr", params);
}
}
return 1;
}
Re: Police & Trucker Channels -
NathNathii - 07.04.2013
Код:
C:\Users\Documents\GT Testing\pawno\include\PlayerCommands.inc(16) : error 029: invalid expression, assumed zero
Line 16
Код:
if (APlayerData[playerid][PlayerClass] == ClassTrucker)
Re: Police & Trucker Channels -
BlackID - 07.04.2013
It seems you haven't define ClassTrucker, try to define it. Or post the code.
Re: Police & Trucker Channels -
NathNathii - 07.04.2013
**Edit works.
Thanks to Kitten for the codes and DerickClark at Skype for telling me to change ClassTrucker to ClassTruckDriver.
Re: Police & Trucker Channels -
NathNathii - 07.04.2013
Forgot to ask about this:
How can I make this so the message only appears to the class?
pawn Код:
SendClientMessageToAll(0xFFFFFFF, string);
Will that work with this?
pawn Код:
SendClientMessage(0xFFFFFFF, string);
Re: Police & Trucker Channels -
BlackID - 07.04.2013
pawn Код:
for(new i; i<MAX_PLAYERS; i++)
{
if(Class_Variable[i] == 1)
{
SendClientMessage(i, COLOR, Message);
}
}
Re: Police & Trucker Channels -
NathNathii - 07.04.2013
Thanks :P