12.10.2013, 15:40
So I made an invite command for my faction system but I don't know how to fix the errors also how do I make so the user has to accept the invite?
/invite command
Errors:
/invite command
PHP код:
CMD:invite(playerid,params[])
{
new factionid,rank,pname[MAX_PLAYER_NAME],factionstring[256],inviterid;
PlayerInfo[playerid][Rank] = rank;
PlayerInfo[playerid][Faction] = factionid;
if(sscanf(params,"u",inviterid)) return SendClientMessage(playerid,COLOR_RED, "Usage: /invite [PlayerID/Name]");
if(PlayerInfo[inviterid][Faction] != 0) return SendClientMessage(playerid,COLOR_RED, "That player is already in a faction!");
if(PlayerInfo[playerid][Rank] = 10) {
GetPlayerName(playerid,pname, sizeof(pname));
PlayerInfo[inviterid][Rank] = 1;
PlayerInfo[inviterid][Faction] = factionid;
format(factionstring,256,"FACTION: %s% %s has invited you to %s%",FactionInfo[factionid][Rank10],pname,FactionInfo[factionid][fname]);
SendClientMessage(inviterid,COLOR_RED,factionstring);
}else {
SendClientMessage(playerid,COLOR_RED,"You are not a leader of a faction!");
return 1;
}
}
Quote:
C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(2024) : warning 219: local variable "factionid" shadows a variable at a preceding level C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(2029) : warning 211: possibly unintended assignment C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(2033) : error 032: array index out of bounds (variable "FactionInfo") C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(2024) : warning 203: symbol is never used: "factionid" C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(2024 -- 2039) : warning 209: function "cmd_invite" should return a value Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error. |