SA-MP Forums Archive
Mission - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Mission (/showthread.php?tid=75584)



Mission - Ribber - 03.05.2009

hey,

can me anyone give a script/code that i make a mission?
if i type /mission i must kill a random guy in the server.
If i killed him, i get 5.000$ and 5 Score (Kills).

Example:

ID1, ID2 and ID3 are connect in the server.
i am ID0 and i type /mission.
then i must kill ID2.


Re: Mission - gpclan - 03.05.2009

hmm what u mean like /misson like kill ryder or somethin


Re: Mission - Andom - 03.05.2009

pawn Код:
new KillPlayer[MAX_PLAYERS];


if (strcmp(cmdtext, "/mission", true) == 0)
{
   new found = 0;
   for(new i; i < MAX_PLAYERS; i++)
   {
     if(found == 0)
     {
        if(IsPlayerConnected(i) && i != playerid)
        {
          found = 1;
          new string[128];
          new PlayerName[MAX_PLAYER_NAME]
          GetPlayerName(i, PlayerName, PlayerName);
          format(string, sizeof(string), "You have to kill %s for $5000 and 5 points!", PlayerName);
          SendClientMessage(playerid, COLOR_RED, string);
          KillPlayer[playerid] = i;
          return 1;
        }  
     }
   }
   if(found == 0)
   {
     SendClientMessage(playerid, COLOR_RED, "There wasn't anybody available!");
   }
   return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
   if(KillPlayer[killerid] == playerid)
   {
     new string[128];
     new PlayerName[MAX_PLAYER_NAME]
     GetPlayerName(playerid, PlayerName, PlayerName);
     format(string, sizeof(string), "You have killed %s and earned $5000 and 5 points!", PlayerName);
     SendClientMessage(killerid, COLOR_YELLOW, string);

     GivePlayerMoney(killerid, 5000);
     SetPlayerScore(killerid, GetPlayerScore(killerid)+5);

     KillPlayer[killerid] = INVALID_PLAYER_ID;
   }
   return 1;
}
Writen in 5 minutes :P


Re: Mission - Ribber - 03.05.2009

thx dude!