SA-MP Forums Archive
[HELP] What to write here??? - 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: [HELP] What to write here??? (/showthread.php?tid=312850)



[HELP] What to write here??? - SampLoverNo123 - 23.01.2012

Look, i had created a custom map and set my event round there... When anyone type /minigun1 he will TP to that area and will get minigun with unlimited ammo. But he can also goto other Teleport by using other teleports like after joining /minigun1 he can do /gotols then he will not lose his minigun Please tell me what to write so nobody can leave the /minigun1 without typing /kill... Please help ..

Код:
CMD:minigun1(playerid, params[])
{
SetPlayerPos(playerid,1367.6130,1540.9064,121.1731);
GivePlayerWeapon(playerid, 38, 22222);
GameTextForPlayer(playerid,"Welcome to Minigun Round, /Kill to quit don't fire outside cage :D",4000,6);
return 1;
}



Respuesta: [HELP] What to write here??? - [Nikk] - 23.01.2012

you can create a variable.Example:


pawn Код:
new VariableDeBloqueo[MAX_PLAYERS];//we create that
pawn Код:
if(VariableDeBloqueo[playerid] == 1) return SendClientMessage(playerid, -1, "Sorry, you are in DM Zone, you have to put /Kill for get out. ");//put this in the top of onplayercommandtext
and:

pawn Код:
CMD:minigun1(playerid, params[])
{
SetPlayerPos(playerid,1367.6130,1540.9064,121.1731);
GivePlayerWeapon(playerid, 38, 22222);
VariableDeBloqueo[playerid] = 1;//the variable is ON
GameTextForPlayer(playerid,"Welcome to Minigun Round, /Kill to quit don't fire outside cage :D",4000,6);
return 1;
}
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    VariableDeBloqueo[playerid] = 0;//the variable is off
    return 1;
}
Meabe this works.


Re: [HELP] What to write here??? - Silentfood - 23.01.2012

Quote:
Originally Posted by SampLoverNo123
Посмотреть сообщение
Look, i had created a custom map and set my event round there... When anyone type /minigun1 he will TP to that area and will get minigun with unlimited ammo. But he can also goto other Teleport by using other teleports like after joining /minigun1 he can do /gotols then he will not lose his minigun Please tell me what to write so nobody can leave the /minigun1 without typing /kill... Please help ..

Код:
CMD:minigun1(playerid, params[])
{
SetPlayerPos(playerid,1367.6130,1540.9064,121.1731);
GivePlayerWeapon(playerid, 38, 22222);
GameTextForPlayer(playerid,"Welcome to Minigun Round, /Kill to quit don't fire outside cage :D",4000,6);
return 1;
}
Use the ResetPlayerWeapons function. So when teleporting do ResetPlayerWeapons(playerid); then equip him/her with the minigun.

Eg.
pawn Код:
CMD:minigun1(playerid, params[]) {
SetPlayerPos(playerid,1367.6130,1540.9064,121.1731);
[B]ResetPlayerWeapons(playerid);[/B]
GivePlayerWeapon(playerid, 38, 22222);
GameTextForPlayer(playerid,"Welcome to Minigun Round, /Kill to quit don't fire outside cage :D",4000,6);
return 1;
}



Re: [HELP] What to write here??? - SampLoverNo123 - 23.01.2012

Thank you very much man


Re: [HELP] What to write here??? - Snowman12 - 23.01.2012

hey man do you mind if I make you a better version? Also how many minigun DM zones do you use?


Re: [HELP] What to write here??? - Snowman12 - 23.01.2012

pawn Код:
new bool: IsPlayerInMinigun[MAX_PLAYERS] = false;
CMD:minigun(playerid, params[])
{
    new Zone;
    if(sscanf(params, "i", Zone)) return SendClientMessage(playerid, -1, "Usage: /minigun <1> ");

    if(IsPlayerInMinigun[playerid]) return SendClientMessage(playerid, -1, "You are currently in a DM zone. /kill to leave.");

    else
    {
        if(strcmp(params, "1", true)) // Add more like this.
        {
            ResetPlayerWeapons(playerid); // Reset the players weapons before anything else
            IsPlayerInMinigun[playerid] = true; // Don't use 1 or 0 with this using bools saves memory.
            SetPlayerPos(playerid,1367.6130,1540.9064,121.1731);
            GivePlayerWeapon(playerid, 38, 0xFFF); // Truly Unlimited Ammo.
            GameTextForPlayer(playerid,"Welcome to Minigun Round, /Kill to quit don't fire outside cage :D",4000,6);
        }
    }
    return 1;
}
Sorry for double post


Re: [HELP] What to write here??? - SampLoverNo123 - 23.01.2012

Thank that's good too.


Re: [HELP] What to write here??? - SampLoverNo123 - 23.01.2012

It not helped me....


Re: [HELP] What to write here??? - SampLoverNo123 - 23.01.2012

Listen i have more teleports in script like /drift 1,2,3,4,5,6,7.. When i go in /minigun1 then i can easly TP to /drift1234 with that weapon .... HELP ME IF YOU CAN! :P


Re: [HELP] What to write here??? - Hoborific - 23.01.2012

Make a public, call the public in every teleport, inside the public check if the variable is true, and return 0, cancelling their teleport.