SA-MP Forums Archive
ID 0 - 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: ID 0 (/showthread.php?tid=68898)



ID 0 - Headshot1108 - 14.03.2009

hi

i have a question.
i would make a /mission command.
when he type /mission he must kill id 0.
when he kill id 0, he have the mission complete.

when he is id 0, than he dont can do the mission

srry for my bad english.


Re: ID 0 - Weirdosport - 14.03.2009

if(playerid == 0)
{
SendClientMessage(playerid, 0xFF00FFAA, "You are ID 0, so there's no point trying to kill ID 0!");
}


Re: ID 0 - Headshot1108 - 14.03.2009

ok thx, but how can i make, that the player kill id 0?


Re: ID 0 - Weirdosport - 14.03.2009

Well any player can kill any other player regardless of what command they type.. If you just want it to tell them what to do:

pawn Код:
if(strcmp(cmdtext, "/mission", true) == 0)
    {
    if(playerid == 0)
      {
      SendClientMessage(playerid, 0xFF00FFAA, "You are ID 0, so there's no point trying to kill ID 0!");
      }
    else if(!IsPlayerConnected(0))
      {
      SendClientMessage(playerid, 0xFF00FFAA, "ID 0 is not connected!");
      }
    else
      {
      new
        Name[MAX_PLAYER_NAME],
        string[100];
      GetPlayerName(0, Name, sizeof(Name));
      format(string, sizeof(string), "Go and kill %s", Name);
      SendClientMessage(playerid, 0xFF00FFAA, string);
      }
    return 1;
    }
But it's fairly pointless


Re: ID 0 - introzen - 14.03.2009

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if( ) //killerid is on mission
{
if(playerid == 0)
{
   //What will happend if the player finishes the mission
}
}
    return 1;
}



Re: ID 0 - Mikep - 14.03.2009

How about IsPlayerConnected?


Re: ID 0 - Weirdosport - 14.03.2009

Quote:
Originally Posted by Mikep
How about IsPlayerConnected?
Altered


Re: ID 0 - Headshot1108 - 14.03.2009

Quote:
Originally Posted by Weirdosport
But it's fairly pointless
hmm, i think so:

a player make a mission that he kill a player.

its bether when he kill a random id that connect.

but this is work, i've test it.

well its better when he kill a random player.


Re: ID 0 - Weirdosport - 14.03.2009

Quote:
Originally Posted by Headshot1108
Quote:
Originally Posted by Weirdosport
But it's fairly pointless
hmm, i think so:

a player make a mission that he kill a player.

its bether when he kill a random id that connect.

but this is work, i've test it.

well its better when he kill a random player.
You could put the random bit in yourself, but that'd take alot more effort and i'm not here to script for you. I will direct you towards the following:

Random


Re: ID 0 - Ghett0 - 14.03.2009

Here:

pawn Код:
new HuntID[MAX_PLAYERS];
new IsHunting[MAX_PLAYERS];

OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/mission", true))
    {
        new
            Msg[19];
        HuntID[playerid] = random(GetMaxPlayers());
        while(HuntID[playerid] == playerid || !IsPlayerConnected(HuntID[playerid])) HuntID[playerid] = random(GetMaxPlayers());
        format(Msg, 19, "You are now hunting for ID %i.", HuntID[playerid]);
        SendClientMessage(playerid, 0xFFFF00FF, Msg);
        IsHunting[playerid] = 1;
        return 1;
    }
    return 0;
}

OnPlayerDeath(playerid, killerid, reason)
{
    if(IsHunting[killerid] == 1 && HuntID[killerid] == playerid)
    {
        SendClientMessage(killer, 0xFFFF00FF, "You have successfully carried out the mission and have been awarded $5000!");
        GivePlayerMoney(killerid, 5000);
    }
    return 1;
}