SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 28/12/2013, 06:00 PM   #1
OssiBaba
Little Clucker
 
Join Date: Nov 2013
Location: Pakistan
Posts: 41
Reputation: 0
Default Need Emergency Help!!

Code:
CMD:duel(playerid, params[])
	{
	if(IsPlayerInRangeOfPoint(playerid,3.0,824.6161,-2046.2646,12.8672))
         SetPlayerPos(playerid, 1302.519897,-1.787510,1001.028259);
         SetPlayerInterior(playerid, 18);
         GivePlayerValidAdminWeapon(playerid , 24 , 100000);
         GivePlayerValidAdminWeapon(playerid , 25 , 100000);
         GivePlayerValidAdminWeapon(playerid , 29 , 100000);
         SetPlayerHealth(playerid , 100);
         SendClientMessage(playerid , COLOR_YELLOW ,"Now you are in New Year Mini-Game (/exitgame)");
         SetPlayerSkin(playerid , 33);
         SetPlayerVirtualWorld(playerid, 0);
         return 1;
 }
I make this CMD but i need one help if some one die so he come back to this POS
Code:
824.6161,-2046.2646,12.8672
__________________
OssiBaba is offline   Reply With Quote
Old 28/12/2013, 06:09 PM   #2
SilentSoul
Gangsta
 
Join Date: Aug 2013
Posts: 810
Reputation: 65
Default Re: Need Emergency Help!!

Make a new global variable to check if the player joined or not let's say Joinedduel so here you go
pawn Code:
new Joinedduel[MAX_PLAYERS];//global variable
CMD:duel(playerid, params[])
    {
    if(IsPlayerInRangeOfPoint(playerid,3.0,824.6161,-2046.2646,12.8672))
         SetPlayerPos(playerid, 1302.519897,-1.787510,1001.028259);
         SetPlayerInterior(playerid, 18);
         GivePlayerValidAdminWeapon(playerid , 24 , 100000);
         GivePlayerValidAdminWeapon(playerid , 25 , 100000);
         GivePlayerValidAdminWeapon(playerid , 29 , 100000);
         SetPlayerHealth(playerid , 100);
         SendClientMessage(playerid , COLOR_YELLOW ,"Now you are in New Year Mini-Game (/exitgame)");
         SetPlayerSkin(playerid , 33);
         SetPlayerVirtualWorld(playerid, 0);
         Joinedduel[playerid] =1;
         return 1;
 }
Now let's move to onplayerspawn (actually after dying)
pawn Code:
public OnPlayerSpawn(playerid)
{
    if(Joinedduel[playerid] == 1)
    {
    SetPlayerPos(playerid,824.6161,-2046.2646,12.8672);
    }
    return 1;
}
Also at your exitgame command reset the variable back to 0.
pawn Code:
CMD:exitgame(playerid,params[])
{
    if(Joinedduel != 1) return SendClientMessage(playerid,-1,"You didn't join the event to leave it");//checking if the player joined the duel event or not.
    Joinedduel[playerid] =0;
    return 1;
}
SilentSoul is offline   Reply With Quote
Old 28/12/2013, 06:09 PM   #3
OssiBaba
Little Clucker
 
Join Date: Nov 2013
Location: Pakistan
Posts: 41
Reputation: 0
Default Re: Need Emergency Help!!

Code:
E:\PRRP\hz\PRRP\gamemodes\PRRP.pwn(46716) : error 017: undefined symbol "Joinedduel"
E:\PRRP\hz\PRRP\gamemodes\PRRP.pwn(46722) : error 021: symbol already defined: "PreloadAnims"
E:\PRRP\hz\PRRP\gamemodes\PRRP.pwn(46724) : error 010: invalid function or declaration
E:\PRRP\hz\PRRP\gamemodes\PRRP.pwn(46729) : error 010: invalid function or declaration
E:\PRRP\hz\PRRP\gamemodes\PRRP.pwn(46731) : error 010: invalid function or declaration
E:\PRRP\hz\PRRP\gamemodes\PRRP.pwn(46736) : error 021: symbol already defined: "SetPlayerArmourEx"
E:\PRRP\hz\PRRP\gamemodes\PRRP.pwn(46736) : warning 215: expression has no effect
E:\PRRP\hz\PRRP\gamemodes\PRRP.pwn(46736) : error 001: expected token: ";", but found ")"
E:\PRRP\hz\PRRP\gamemodes\PRRP.pwn(46736) : error 021: symbol already defined: "SetPlayerWeaponsEx"
E:\PRRP\hz\PRRP\gamemodes\PRRP.pwn(46736 -- 46737) : fatal error 107: too many error messages on one line
Errors
__________________
OssiBaba is offline   Reply With Quote
Old 28/12/2013, 06:18 PM   #4
OssiBaba
Little Clucker
 
Join Date: Nov 2013
Location: Pakistan
Posts: 41
Reputation: 0
Default Re: Need Emergency Help!!

Code:
public OnPlayerSpawn(playerid) {

	PreloadAnims(playerid);

	if(!gPlayerLogged[playerid])
    {// The player doesn't actually spawn before logging in, this is just to get rid of the annoying "<<", ">>" and "Spawn" buttons in the login/registration screen.
        TogglePlayerControllable(playerid, 0);
        PlayAudioStreamForPlayer(playerid, "http://www.woo55.com/adata/11069/ow59LUN3ODCf.129.mp3");

        return 1;
	}
	if(InsideShamal[playerid] != INVALID_VEHICLE_ID)
	{
		SetPlayerPos(playerid, GetPVarFloat(playerid, "air_Xpos"), GetPVarFloat(playerid, "air_Ypos"), GetPVarFloat(playerid, "air_Zpos"));
		SetPlayerFacingAngle(playerid, GetPVarFloat(playerid, "air_Rpos"));
		SetPlayerHealth(playerid, GetPVarFloat(playerid, "air_HP"));
		SetPlayerArmourEx(playerid, GetPVarFloat(playerid, "air_Arm"));
		SetPlayerWeaponsEx(playerid);
		SetPlayerToTeamColor(playerid);
		SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);



		DeletePVar(playerid, "air_Xpos");
		DeletePVar(playerid, "air_Ypos");
		DeletePVar(playerid, "air_Zpos");
		DeletePVar(playerid, "air_Rpos");
		DeletePVar(playerid, "air_HP");
		DeletePVar(playerid, "air_Arm");

		SetCameraBehindPlayer(playerid);
		SetPlayerVirtualWorld(playerid, InsideShamal[playerid]);
		return SetPlayerInterior(playerid, 1);
	}

    Streamer_Update(playerid);

	SyncPlayerTime(playerid);
    if(IsPlayerNPC(playerid)) return 1;
	SetPlayerWantedLevel(playerid, PlayerInfo[playerid][pWantedLevel]);
	DeletePVar(playerid, "STD");

	SetCameraBehindPlayer(playerid);
	SetPlayerSpawn(playerid);
	SetPlayerWeapons(playerid);
	SetPlayerToTeamColor(playerid);

	SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 1);
	return 1;
}
This is my onplayerspawn pls set it to this

pawn Code:
public OnPlayerSpawn(playerid)
{
    if(Joinedduel[playerid] == 1)
    {
    SetPlayerPos(playerid,824.6161,-2046.2646,12.8672);
    }
    return 1;
}
__________________
OssiBaba is offline   Reply With Quote
Old 28/12/2013, 06:19 PM   #5
Hansrutger
Gangsta
 
Hansrutger's Avatar
 
Join Date: May 2011
Location: Sweden
Posts: 766
Reputation: 158
Default Re: Need Emergency Help!!

It's like SilentSoul said above but on OnPlayerDeath.
This will make an array that will contains of 0 and 1. Why [MAX_PLAYERS]? Because then you can put "playerid" inside. MAX_PLAYERS is the same like writing any player ingame ID that is valid. (playerid is the ID of the player typing the command below):
pawn Code:
//On top of your code, at your includes or something:
inDual[MAX_PLAYERS];

Inside the command you put whatever you like but also put the array thing equals to 1.
pawn Code:
CMD:duel(playerid, o[])
{
   //Your code

   //and also this:
   inDual[playerid] = 1;
}

This will make so player spawns when he dies AND when inDual for the playerid itself is 1. To prevent the player from being spawned there each time he died, we put "inDual[playerid] = 0" to indicate that he is no longer in dual, unless you want him to be then just remove that line!
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
   if(inDual[playerid] == 1)
   {
        SetPlayerPos(playerid, 824.6161, -2046.2646, 12.8672);
        inDual[playerid] = 0;
   }
   return 1;
}
__________________


Hansrutger is offline   Reply With Quote
Old 28/12/2013, 06:24 PM   #6
OssiBaba
Little Clucker
 
Join Date: Nov 2013
Location: Pakistan
Posts: 41
Reputation: 0
Default Re: Need Emergency Help!!

Code:
E:\PRRP\hz\PRRP\gamemodes\PRRP.pwn(62113) : error 010: invalid function or declaration
E:\PRRP\hz\PRRP\gamemodes\PRRP.pwn(62118) : warning 217: loose indentation
E:\PRRP\hz\PRRP\gamemodes\PRRP.pwn(62126) : error 017: undefined symbol "inDual"
E:\PRRP\hz\PRRP\gamemodes\PRRP.pwn(62126) : warning 215: expression has no effect
E:\PRRP\hz\PRRP\gamemodes\PRRP.pwn(62126) : error 001: expected token: ";", but found "]"
Error
__________________
OssiBaba is offline   Reply With Quote
Old 28/12/2013, 06:37 PM   #7
OssiBaba
Little Clucker
 
Join Date: Nov 2013
Location: Pakistan
Posts: 41
Reputation: 0
Default Re: Need Emergency Help!!

Quote:
Originally Posted by Hansrutger View Post
It's like SilentSoul said above but on OnPlayerDeath.
This will make an array that will contains of 0 and 1. Why [MAX_PLAYERS]? Because then you can put "playerid" inside. MAX_PLAYERS is the same like writing any player ingame ID that is valid. (playerid is the ID of the player typing the command below):
pawn Code:
//On top of your code, at your includes or something:
inDual[MAX_PLAYERS];

Inside the command you put whatever you like but also put the array thing equals to 1.
pawn Code:
CMD:duel(playerid, o[])
{
   //Your code

   //and also this:
   inDual[playerid] = 1;
}

This will make so player spawns when he dies AND when inDual for the playerid itself is 1. To prevent the player from being spawned there each time he died, we put "inDual[playerid] = 0" to indicate that he is no longer in dual, unless you want him to be then just remove that line!
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
   if(inDual[playerid] == 1)
   {
        SetPlayerPos(playerid, 824.6161, -2046.2646, 12.8672);
        inDual[playerid] = 0;
   }
   return 1;
}

Not working
__________________
OssiBaba is offline   Reply With Quote
Old 28/12/2013, 06:46 PM   #8
OssiBaba
Little Clucker
 
Join Date: Nov 2013
Location: Pakistan
Posts: 41
Reputation: 0
Default Re: Need Emergency Help!!

Not working help me pls
__________________
OssiBaba is offline   Reply With Quote
Old 28/12/2013, 06:55 PM   #9
xVIP3Rx
High-roller
 
xVIP3Rx's Avatar
 
Join Date: Feb 2013
Location: Egypt
Posts: 1,098
Reputation: 96
Default Re: Need Emergency Help!!

pawn Code:
new bool:InDuel[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
    if(InDuel[playerid]) SetPlayerPos(playerid,824.6161,-2046.2646,12.8672);

    //Rest of codes
    return 1;
}

CMD:duel(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid,3.0,824.6161,-2046.2646,12.8672))
    {
         SetPlayerPos(playerid, 1302.519897,-1.787510,1001.028259);
         SetPlayerInterior(playerid, 18);
         GivePlayerValidAdminWeapon(playerid , 24 , 100000);
         GivePlayerValidAdminWeapon(playerid , 25 , 100000);
         GivePlayerValidAdminWeapon(playerid , 29 , 100000);
         SetPlayerHealth(playerid , 100);
         SendClientMessage(playerid , COLOR_YELLOW ,"Now you are in New Year Mini-Game (/exitgame)");
         SetPlayerSkin(playerid , 33);
         SetPlayerVirtualWorld(playerid, 0);
         InDuel[playerid] = true;
    }
    return 1;
}

CMD:exitduel(playerid,params[])
{
    if(!InDuel[playerid]) return SendClientMessage(playerid,COLOR_YELLOW,"You're not in the deathmath");//checking if the player joined the duel event or not.

    InDuel[playerid] = false;
    return 1;
}
xVIP3Rx is offline   Reply With Quote
Old 28/12/2013, 07:05 PM   #10
OssiBaba
Little Clucker
 
Join Date: Nov 2013
Location: Pakistan
Posts: 41
Reputation: 0
Default Re: Need Emergency Help!!

I want that if player die so spawn back in 824.6161,-2046.2646,12.8672
__________________
OssiBaba is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
emergency! xXitsgodzillaXx Server Support 7 10/04/2012 02:37 PM
emergency best_killa Everything and Nothing 9 01/08/2011 02:59 PM
[EMERGENCY] Help please, ! Darklom Help Archive 10 02/01/2011 09:50 PM
EMERGENCY Help Please! Thrarod Help Archive 3 11/06/2010 02:49 PM
Emergency Help! Smiths Help Archive 5 14/02/2010 06:07 PM


All times are GMT. The time now is 03:00 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.