Ref System.
#1

Good day mates.
I need a referral system, I've tried multiple times but I cannot get the script right. I want to see the code again, because I havn't scripted in awhile.

Params: /ref [playerid]

- When you do /ref, the player using the command has to have EXACTLY 3 playing hours.
pawn Код:
PlayerInfo[playerid][pConnectHours] == 3
- When they use the command, it sets their hours to 4 and gives them +75 credits.
pawn Код:
PlayerInfo[giveplayerid][pConnectHours] == 4
PlayerInfo[giveplayerid][pCredits] += 75
- Once they do the command, it sends a message to admins. I'm not so sure on this code, but it sends to anyone with ..
pawn Код:
PlayerInfo[playerid][pAdmin] >= 2
Sorry if I got some codings wrong, that's why I'm here so I can get help in fixing those mistakes. (-:

zCMD by the way.

Thanks a lot!
Reply
#2

pawn Код:
for(new cycle = 0; cycle < MAX_PLAYERS-1; cycle++)
{
   if(PlayerInfo[cycle][pAdmin] >= 2)
   //codes here..
}
This is a for loop. It looks through all players. and the "if(PlayerInfo..." line checks if the player is admin..
Anyways, that is what you need.
Reply
#3

Read the whole thing, please.
Reply
#4

I'm only doing this cause you haven't scripted in a while... I hope you learn instead of copy/pasting.
pawn Код:
CMD:ref(playerid,params[])
{
   new id;
   if(sscanf(params,"u",id)) return SendClientMessage(playerid,-1,""FFFFFFFF"/ref [playerid]");//params stuff...
   if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,""FFFFFFFF"Invalid Player.");//if he is connected
   if(PlayerInfo[playerid][pConnectHours] != 3) return SendClientMessage(playerid,-1,""FFFFFFFF"Your c-time must be exactly 3 hours.");//conecttime
   PlayerInfo[giveplayerid][pConnectHours] == 4//if he has all atuff above, then do this and below it.
   PlayerInfo[giveplayerid][pCredits] += 75
   for(new cycle = 0; cycle < MAX_PLAYERS-1; cycle++)//go through every player.
   {
      if(PlayerInfo[cycle][pAdmin] >= 2)//check if he is admin.
      {
         new string[256]
         new pName[24]
         GetPlayerName(cycle,pName,sizeof(pName));
         format(string,sizeof(string),"  "%s has [blahblahblah]",pName);
         SendClientMessage(cycle,-1,string);
   }
   return 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)