invite help. - 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)
+--- Thread: invite help. (
/showthread.php?tid=491269)
invite help. -
MaDsON - 30.01.2014
Okay.. So I want this command (/invite) to show this...
** FactionRank PlayerName has offered you an invite to FactionName - type /accept faction to join.
or with factionrank, playername, and factionname..
** Director John Doe has offered you an invite to DHS - type /accept faction to join.
Here is my full code so far on scripting this in.. (I put down a note to show where it pulls 'Faction Rank' from - as it works on the player name part and the faction name, I'm just trying to add the rank.)
command
pawn Код:
CMD:invite(playerid, params[])
{
if (PlayerInfo[playerid][pLeader] >= 1)
{
new string[128], ftext[50], giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /invite [playerid]");
if(IsPlayerConnected(giveplayerid))
{
if (PlayerInfo[giveplayerid][pLeader] == 0 && PlayerInfo[giveplayerid][pMember] == 0 && PlayerInfo[giveplayerid][pFMember] == 255)
{
if(PlayerInfo[playerid][pLeader] == 1) { ftext = faction1name; }
else if(PlayerInfo[playerid][pLeader] == 2) { ftext = faction2name; }
else if(PlayerInfo[playerid][pLeader] == 3) { ftext = faction3name; }
else if(Team_LSFMD(playerid)) { ftext = faction4name; }
else if(PlayerInfo[playerid][pLeader] == 5) { ftext = "Judicial System"; }
else if(PlayerInfo[playerid][pLeader] == 6) { ftext = faction6name; }
else if(PlayerInfo[playerid][pLeader] == 7) { ftext = faction7name; }
else if(PlayerInfo[playerid][pLeader] == 8) { ftext = faction8name; }
else if(PlayerInfo[playerid][pLeader] == 9) { ftext = faction9name; }
else if(PlayerInfo[playerid][pLeader] == 10) { ftext = "Taxi Cab Company"; }
else if(PlayerInfo[playerid][pLeader] == 11) { ftext = faction11name; }
else if(PlayerInfo[playerid][pLeader] == 12) { ftext = "Tierra Robada"; }
else if(PlayerInfo[playerid][pLeader] == 13) { ftext = faction13name; }
// Starts to grab the players rank.
new plrank[50];
if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 0 *then plrank == faction1rankdef;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 1 *then plrank == faction1rank1;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 2 *then plrank == faction1rank2;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 3 *then plrank == faction1rank3;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 4 *then plrank == faction1rank4;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 5 *then plrank == faction1rank5;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 6 *then plrank == faction1rank6;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 7 *then plrank == faction1rank7;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 8 *then plrank == faction1rank8;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 9 *then plrank == faction1rank9;
// ends getting the players rank.
InviteOffer[giveplayerid] = playerid;
InviteFamily[giveplayerid] = 255;
InviteFaction[giveplayerid] = PlayerInfo[playerid][pLeader];
format(string, sizeof(string), "%s %s has offered you an invite to %s - type /accept faction.", plrank, GetPlayerNameEx(playerid), ftext);
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have offered %s an invite to %s.", GetPlayerNameEx(giveplayerid),ftext);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "The player you're trying to invite is already in another faction or family.");
return 1;
}
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command - only leaders can do this.");
}
return 1;
}
Errors.
Код:
C:\Users\Randy\Desktop\Madson Roleplay (Official Server)\gamemodes\KG.pwn(58246) : error 033: array must be indexed (variable "plrank")
C:\Users\Randy\Desktop\Madson Roleplay (Official Server)\gamemodes\KG.pwn(58247) : error 033: array must be indexed (variable "plrank")
C:\Users\Randy\Desktop\Madson Roleplay (Official Server)\gamemodes\KG.pwn(58248) : error 033: array must be indexed (variable "plrank")
C:\Users\Randy\Desktop\Madson Roleplay (Official Server)\gamemodes\KG.pwn(58249) : error 033: array must be indexed (variable "plrank")
C:\Users\Randy\Desktop\Madson Roleplay (Official Server)\gamemodes\KG.pwn(58250) : error 033: array must be indexed (variable "plrank")
C:\Users\Randy\Desktop\Madson Roleplay (Official Server)\gamemodes\KG.pwn(58251) : error 033: array must be indexed (variable "plrank")
C:\Users\Randy\Desktop\Madson Roleplay (Official Server)\gamemodes\KG.pwn(58252) : error 033: array must be indexed (variable "plrank")
C:\Users\Randy\Desktop\Madson Roleplay (Official Server)\gamemodes\KG.pwn(58253) : error 033: array must be indexed (variable "plrank")
C:\Users\Randy\Desktop\Madson Roleplay (Official Server)\gamemodes\KG.pwn(58254) : error 033: array must be indexed (variable "plrank")
C:\Users\Randy\Desktop\Madson Roleplay (Official Server)\gamemodes\KG.pwn(58255) : error 033: array must be indexed (variable "plrank")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
10 Errors.
Re: invite help. -
Shockey HD - 30.01.2014
pawn Код:
if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 0 *then plrank == faction1rankdef;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 1 *then plrank == faction1rank1;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 2 *then plrank == faction1rank2;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 3 *then plrank == faction1rank3;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 4 *then plrank == faction1rank4;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 5 *then plrank == faction1rank5;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 6 *then plrank == faction1rank6;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 7 *then plrank == faction1rank7;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 8 *then plrank == faction1rank8;
else if PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] == 9 *then plrank == faction1rank9;
Are you setting the variable here? if so only use one = sign.