Got confused with a SCRIPT! - 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: Got confused with a SCRIPT! (
/showthread.php?tid=494097)
Got confused with a SCRIPT! -
Ady_Ro - 11.02.2014
Hello SA-MP World!
My name is Ady .
And i've got confused about a function
Let me explain.
A player x is in gang y , when player x got killed by player z which is in gang y . I want to make a dialog to show them
1.Kill member
2.Reset Player Weapons
3.Free [don't make anything]
So i will show you the function
pawn Код:
if ( Users[ killerid ][ gang ] == Users[ playerid ][ gang ] )
FormatMSG( playerid, COLOR_ULTRARED, "!! ATENTION !!: %s , killed you and he is with you in gang !", PlayerName( killerid ) );
This is the originally now what's i did
if ( Users[ killerid ][ gang ] == Users[ playerid ][ gang ] )
ShowPlayerDialog(playerid, DIALOG_GANGKILLED, DIALOG_STYLE_LIST, "You've got killed by a gang member", "Kill member\nReset Player Weapons\nFree", "Select", "Leave");
// Now that's my problem, here i'm blocked .
OnDialogResponse(bla bla)
{
case DIALOG_GANGKILLED:
{
switch( listitem )
{
case 0: // here's the problem how i can make to kill the player z who killed player x ? I'm think it's using foreach but i don't know ... please help me ! :)
I will hope you to help me !
REGARDS~~
AW: Got confused with a SCRIPT! -
Nero_3D - 11.02.2014
You need to pass the killerid to OnDialogResponse
Just save it in a global array in OnPlayerDeath and recall it in OnDialogResponse
Re: Got confused with a SCRIPT! -
Ady_Ro - 11.02.2014
Hmmm like making a new variable like : new GangKilled[ MAX_PLAYERS ];
And when player x got killed by player y
GangKilled[killerid] = 1;
Something like this ?
AW: Got confused with a SCRIPT! -
Nero_3D - 11.02.2014
More like
pawn Код:
new // Can be used for different dialogs and other things
gCarry[MAX_PLAYERS] // Just a variable to carry data across functions
;
pawn Код:
if ( Users[ killerid ][ gang ] == Users[ playerid ][ gang ] ) {
ShowPlayerDialog(playerid, DIALOG_GANGKILLED, DIALOG_STYLE_LIST, "You've got killed by a gang member", "Kill member\nReset Player Weapons\nFree", "Select", "Leave");
gCarry[playerid] = killerid;
}
pawn Код:
//
case DIALOG_GANGKILLED: {
switch( listitem ) {
case 0: SetPlayerHealth(gCarry[playerid], 0.0);
case 1: ResetPlayerWeapons(gCarry[playerid]);
case 2: SendClientMessage(gCarry[playerid], -1, "Blabla spared your live!");
}
}
Re: Got confused with a SCRIPT! -
Ady_Ro - 11.02.2014
Lol thanks , i hope will works +REP!