11.09.2009, 22:02
Hi, i'm wondering how I would go about doing this...
I have created a menu named "clanwar1", now.. I want when you type it and select, let's say... attackers. It will store your old name (Lets use me as an example, "Sky") in a file or something (I really don't know how to store information), and then set your name to [ATK]%s. (Or, [ATK]Sky in my case) Then, when you type /leave, it would set your name back to the old one, i tried the same below, but it didn't set my name to the old one, instead it set my name to... [ATK][DEF]Sky, because I switched teams, it just didn't switch my name back when I typed /leave. Yeah, indentation is messed up due to PHP, oh well >_<;
Thanks, Sky.
I have created a menu named "clanwar1", now.. I want when you type it and select, let's say... attackers. It will store your old name (Lets use me as an example, "Sky") in a file or something (I really don't know how to store information), and then set your name to [ATK]%s. (Or, [ATK]Sky in my case) Then, when you type /leave, it would set your name back to the old one, i tried the same below, but it didn't set my name to the old one, instead it set my name to... [ATK][DEF]Sky, because I switched teams, it just didn't switch my name back when I typed /leave. Yeah, indentation is messed up due to PHP, oh well >_<;
Thanks, Sky.
pawn Код:
if(strcmp(cmd, "/leave", true) == 0)
{
if(gTeam[playerid] == ClanWar1)
{
SendClientMessage(playerid, red, ">> You have left the Clan War Arena. (Your weapons have been reset)");
ResetPlayerWeapons(playerid);
SetPlayerPos(playerid, 1107.9076,-1793.4313,16.5938);
gTeam[playerid] = Player;
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);
format(string, sizeof(string), "[Free]%s", oldname);
SetPlayerName(playerid, string);
return 1;
}
if(gTeam[playerid] != ClanWar1)
{
SendClientMessage(playerid, red, "Error: You are not in a Clan War Arena.");
return 1;
}
}
pawn Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:CurrentMenu = GetPlayerMenu(playerid);
if(CurrentMenu == clanwar1)
{
switch(row)
{
case 0:
{
new name[MAX_PLAYER_NAME];
new string[128];
SetPlayerPos(playerid, -49.9316, -272.0252, 6.6332);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, purple, ">> You have selected 'Clan War 1: Attack', Spawning now.");
SendClientMessage(playerid, orange, "Important: In order to leave, type '/leave'.");
GivePlayerWeapon(playerid, 24, 500);
GivePlayerWeapon(playerid, 29, 500);
GivePlayerWeapon(playerid, 34, 500);
GivePlayerWeapon(playerid, 31, 500);
GivePlayerWeapon(playerid, 8, 1);
gTeam[playerid] = ClanWar1;
TogglePlayerControllable(playerid, 1);
oldname = GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[ATK]%s", name);
SetPlayerName(playerid, string);
}
case 1:
{
new name[MAX_PLAYER_NAME];
new string[128];
SetPlayerPos(playerid, -86.2610, -302.1626, 2.7646);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, purple, ">> You have selected 'Clan War 1: Defence', Spawning now.");
SendClientMessage(playerid, orange, "Important: In order to leave, type '/leave'.");
GivePlayerWeapon(playerid, 24, 500);
GivePlayerWeapon(playerid, 29, 500);
GivePlayerWeapon(playerid, 34, 500);
GivePlayerWeapon(playerid, 31, 500);
GivePlayerWeapon(playerid, 8, 1);
gTeam[playerid] = ClanWar1;
TogglePlayerControllable(playerid, 1);
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[DEF]%s", name);
SetPlayerName(playerid, string);
}
}
}
return 1;
}