I use GUPS 1.15 as base
And there is lot of problems:
else if (strcmp(cmd, "!duel", true) == 0) {
if(PlayerInfo[playerid][Logged] != 1) { SendClientMessage(playerid, COLOR_RED, "You need to login first!"); }
else {
SendClientMessage(playerid, COLOR_RED, "Duel commands: !duelj - Joins duel !duell - Leaves duel if second player does suicide or drown in water");
}
return 1;
}
else if (strcmp(cmd, "!duelj", true) == 0) {
if(PlayerInfo[playerid][Logged] != 1) {
SendClientMessage(playerid, COLOR_RED, "You need to login first!");
}
else if (strcmp(PlayerInfo[playerid][Duel], "1", true) == 0)
{
SendClientMessage(playerid, COLOR_RED, "You already is in duel!");
}
else {
DuelStart(playerid);
if (strcmp(GetFileText("Duel/place.txt"), "0", true) == 0) {
new string[128];
ResetPlayerWeapons(playerid);
SetPlayerWeapon(playerid, 21, 100);
SetPlayerPos(playerid, -349.444946, -1630.163452, 11.637629, 0, 0);
new File:duel=fopen("Duel/place.txt", io_append);
format(string, 256, "1");
fwrite(duel, string);
fclose(duel);
SendClientMessage(playerid, COLOR_ORANGE, "Joining duel");
}
else if (strcmp(GetFileText("Duel/place.txt"), "01", true) == 0) {
new string[128];
ResetPlayerWeapons(playerid);
SetPlayerWeapon(playerid, 21, 100);
SetPlayerPos(playerid, -336.983032, -1646.011840, 11.637629, 180, 0);
new File:duel=fopen("Duel/place.txt", io_append);
format(string, 256, "1");
fwrite(duel, string);
fclose(duel);
SendClientMessage(playerid, COLOR_ORANGE, "Joining duel");
}
else if (strcmp(GetFileText("Duel/place.txt"), "011", true) == 0) {
SendClientMessage(playerid, COLOR_ORANGE, "Duel is full!");
}
}
return 1;
}
else if (strcmp(cmd, "!duell", true) == 0) {
if(PlayerInfo[playerid][Duel] == 0) SendClientMessage(playerid, COLOR_RED, "You aren't in duel!");
else if (strcmp(GetFileText("Duel/place.txt"), "0", false) == 0) SendClientMessage(playerid, COLOR_RED, "Wanted escape?");
else if (strcmp(PlayerInfo[playerid][Duel], "1", true) == 0) DuelWon(playerid);
return 1;
}
stock IncPlayerDuelWons(playerid)
{
format(file, sizeof(file), USERS_FILE, gPlayers[playerid]);
new duelw; duelw = dini_Int(file, "DuelWons");
dini_IntSet(file, "DuelWons", duelw +1);
}
stock IncPlayerDuelLoses(playerid)
{
format(file, sizeof(file), USERS_FILE, gPlayers[playerid]);
new duell; duell = dini_Int(file, "DuelLoses");
dini_IntSet(file, "DuelLoses", duell +1);
}
stock DuelStart(playerid)
{
format(file, sizeof(file), USERS_FILE, gPlayers[playerid]);
dini_IntSet(file, "Duel", 1);
}
stock DuelWon(playerid)
{
format(file, sizeof(file), USERS_FILE, gPlayers[playerid]);
dini_IntSet(file, "Duel", 0);
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new string[MAX_STRING];
format(string,sizeof(string),"%s win in duel",name);
SendClientMessageToAll(ORANGE,string);
IncPlayerDuelWons(playerid);
SetPlayerPos(playerid, -731.411499,-1526.219848,12.526686,120,0);
}
stock DuelLos(playerid)
{
new string[128];
format(file, sizeof(file), USERS_FILE, gPlayers[playerid]);
dini_IntSet(file, "Duel", 0);
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new string2[MAX_STRING];
format(string2,sizeof(string),"%s lost in duel",name);
SendClientMessageToAll(ORANGE,string2);
IncPlayerDuelLoses(playerid);
new File:duel=fopen("Duel/place.txt", io_write);
format(string, 256, "0");
fwrite(duel, string);
fclose(duel);
}
Thanks for that people who helped me.