Mission
#1

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.
Reply
#2

hmm what u mean like /misson like kill ryder or somethin
Reply
#3

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
Reply
#4

thx dude!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)