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;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if( ) //killerid is on mission
{
if(playerid == 0)
{
//What will happend if the player finishes the mission
}
}
return 1;
}
|
Originally Posted by Mikep
How about IsPlayerConnected?
|
|
Originally Posted by Weirdosport
But it's fairly pointless
|
|
Originally Posted by Headshot1108
Quote:
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. |
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;
}