SA-MP Forums Archive
How to? - 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)
+--- Thread: How to? (/showthread.php?tid=310413)



How to? - Twinki1993 - 12.01.2012

Well I keep trying to make a small mission that triggers when I type /mission as admin. I don't get it why but it's not working.
This command should be for a specific team. So when admin types /missionstart it should give all players from Team 1 message "Deffend the truck!" and from the other side they should get the checkpoint and message.


Код HTML:
    if (strcmp("/startmission", cmdtext, true) == 0)
    {
        if(!IsPlayerAdmin(playerid))
	    {
			SendClientMessage(playerid, COLOR_RED, "<!>You are not an admin!");
			return 1;
		}
	    if(GetPlayerTeam(playerid) == 1)
		{
			SendClientMessage(playerid, COLOR_LIGHTBLUE, "<!>Mission: Defend the truck!");
		    return 1;
		}
		if(GetPlayerTeam(playerid) == 2)
		{
            CreateCheckpoint(-1426.42, 478.65, 5.61, 5, 10, 0);
		    SendClientMessage(playerid, COLOR_LIGHTBLUE, "<!>Mission: Get the truck and deliver it at the base!");
		    return 1;
		}
	}
The code looks retarded here, but it's normal in the GM so don't worry, it's not lost of indetification...


Re: How to? - coole210 - 12.01.2012

pawn Код:
if (strcmp("/startmission", cmdtext, true) == 0)
    {
        if(!IsPlayerAdmin(playerid))
        {
            SendClientMessage(playerid, COLOR_RED, "<!>You are not an admin!");
            return 1;
        }
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(GetPlayerTeam(i) == 1)
                {
                    SendClientMessage(i, COLOR_LIGHTBLUE, "<!>Mission: Defend the truck!");
                    return 1;
                }
                if(GetPlayerTeam(i) == 2)
                {
                    SetPlayerCheckpoint(i,-1426.42, 478.65, 5.61,5);
                    SendClientMessage(i, COLOR_LIGHTBLUE, "<!>Mission: Get the truck and deliver it at the base!");
                    return 1;
                }
            }
        }
    }
Rep


Re: How to? - Twinki1993 - 12.01.2012

Oh thanks, I will test that ^_^ I gave you the rep ^_^