if(strfind(Player[i][Ref], "Nothing", false))
{
new Referral = Player[i][Ref];
format(string, sizeof(string), "Accounts/%s.ini", Player[i][Ref]);
if(fexist(string))
{
if (IsPlayerConnected(Referral))
{
Player[Referral][Refs]++;
Player[Referral][Money] += 10000;
Player[Referral][Pot] += 20;
Player[Referral][Cocaine] += 15;
Player[Referral][Materials] += 2000;
SendClientMessage(i, DEPARTMENT_CHAT, "Your referral is online and was rewarded, as you reached your fifth playing hour!.");
SendClientMessage(i, DEPARTMENT_CHAT, "Enjoy the server.");
SendClientMessage(Referral, DEPARTMENT_CHAT, "One of the players you brought to the server reached his fifth played hour!", GetName(i));
SendClientMessage(Referral, DEPARTMENT_CHAT, "You were given a reward! Thanks for your effort to improve the community!");
format(string, sizeof(string), "%s gained 5 playing hours - he was brought by %s.", Referral, i);
RefLog(string);
}
else
{
format(string, sizeof(string), "Accounts/%s.ini", Player[i][Ref]);
dini_IntSet(string, "PendingRef", 1);
SendClientMessage(Referral, DEPARTMENT_CHAT, "Your referral is not online but he'll be rewarded when he's online, for your fifth playing hour!", Player[i][Ref]);
SendClientMessage(Referral, DEPARTMENT_CHAT, "Enjoy the server.");
format(string, sizeof(string), "%s gained 5 playing hours - he was brought by %s but was not online!", Referral, i);
RefLog(string);
}
}
else
{
SendClientMessage(i, WHITE, "Your referral changed his name! Unable to reward him.");
}
}
You cannot use the command if the player is not online,
the only way is SQLite or MYSQL |
if(strfind(Player[i][Ref], "Nothing", false))
{
new Referral = Player[i][Ref];
if (IsPlayerConnected(Referral))
{
Player[Referral][Refs]++;
Player[Referral][Money] += 10000;
Player[Referral][Pot] += 20;
Player[Referral][Cocaine] += 15;
Player[Referral][Materials] += 2000;
SendClientMessage(i, DEPARTMENT_CHAT, "Your referral is online and was rewarded, as you reached your fifth playing hour!.");
SendClientMessage(i, DEPARTMENT_CHAT, "Enjoy the server.");
SendClientMessage(Referral, DEPARTMENT_CHAT, "One of the players you brought to the server reached his fifth played hour!", GetName(i));
SendClientMessage(Referral, DEPARTMENT_CHAT, "You were given a reward! Thanks for your effort to improve the community!");
format(string, sizeof(string), "%s gained 5 playing hours - he was brought by %s.", Referral, i);
RefLog(string);
}
else
{
format(string, sizeof(string), "Accounts/%s.ini", Player[i][Ref]);
dini_IntSet(string, "PendingRef", 1);
SendClientMessage(Referral, DEPARTMENT_CHAT, "Your referral is not online but he'll be rewarded when he's online, for your fifth playing hour!", Player[i][Ref]);
SendClientMessage(Referral, DEPARTMENT_CHAT, "Enjoy the server.");
format(string, sizeof(string), "%s gained 5 playing hours - he was brought by %s but was not online!", Referral, i);
RefLog(string);
}
}
command(referral, playerid, params[])
{
new Name[128], string[128], string2[128], reffer[128];
if(sscanf(params, "s", Name))
{
if(Player[playerid][PlayingHours] >= 0)
{
SendClientMessage(playerid, WHITE, "SYNTAX: /referral [name]");
SendClientMessage(playerid, GREY, "Type the FULL NAME of your referral, and not an ID");
SendClientMessage(playerid, GREY, "NOTE: This command is CaSe SeNsItIvE.");
}
}
else
{
if(Player[playerid][PlayingHours] >= 0)
{
if(strlen(Name) >= 3 && strlen(Name) < MAX_PLAYER_NAME+1)
{
format(string2, sizeof(string2), "Accounts/%s.ini", Name);
if(fexist(string2))
{
if(Player[playerid][PlayingHours] >= 3)
{
SendClientMessage(playerid, WHITE, "You already have more than two playing hours, you cannot do this anymore!");
}
else
{
//reffer = Name;
format(string, sizeof(string), "You added %s succesfully as your referral!", Name);
SendClientMessage(playerid, WHITE, string);
format(string, sizeof(string), "If you had a referral already, that one got replaced!");
SendClientMessage(playerid, WHITE, string);
format(Player[playerid][Ref], sizeof(string), Name);
Player[playerid][Authenticated] = 1;
}
}
else
{
SendClientMessage(playerid, WHITE, "Account not found. Remember this command is CaSe SeNsEtIvE ");
}
}
}
}
return 1;
}
if(fexist(string2))
if(dini_Exists(string2))
P.S. new Referral = Player[i][Ref]; < You can't do something like this. Use 'format'
|
Can you please write it fully out for me (how I should paste it in the script)
Thanks in advance. |
new Referral[MAX_PLAYER_NAME];
format(Referral,sizeof(Referral),"%s",Player[i][Ref]);
strmid(Referral, Player[i][Ref], 0, strlen(Player[i][Ref]), MAX_PLAYER_NAME);