forward GetClosestPlayerToPlayer(playerid);
public GetClosestPlayerToPlayer(playerid)
command(Class,playerid,params[])
{
if(gTeam[playerid] == Zombie)
{
ShowPlayerDialog(playerid, ZCLASS, DIALOG_STYLE_LIST, "Class Selection", "{FF0000}Bite(30HP)\n{00FF00}High Jump", "Select", "Cancle");
}
else if(gTeam[playerid] == Vampire)
{
ShowPlayerDialog(playerid, VCLASS, DIALOG_STYLE_LIST, "Class Selection", "{FF0000}Bite (30HP)\n{00FF00}Tp to nearest player", "Select", "Cancle");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
case DIALOG_ZCLASS:
{
if(!response) return ShowPlayerDialog(playerid,-1,0,"","","","");
if(response)
{
forward GetClosestPlayerToPlayer(playerid);
public GetClosestPlayerToPlayer(playerid)
{
new Float:dist = 1000.0;
new targetid = INVALID_PLAYER_ID;
new Float:x1,Float:y1,Float:z1;
new Float:x2,Float:y2,Float:z2;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(i == playerid) continue;
GetPlayerPos(i,x2,y2,z2);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
if(tmpdis < dist)
{
dist = tmpdis;
targetid = i;
}
}
return targetid;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
case DIALOG_ZCLASS:
{
if(!response) return ShowPlayerDialog(playerid,-1,0,"","","","");
if(response)
{
switch(listitem)// Checking which listitem was selected
{
case 0:
{
if(gTeam[playerid] == Zombie)
{
new id = GetClosestPlayerToPlayer(playerid);
new Float:x,Float:y,Float:z;
GetPlayerPos(id,x,y,z);
SetPlayerPos(playerid,x,z,z);
}
case 1:
{
//Whatever you want in case 1
}
}
}
}
}
@Raxor, Nope it needs "switch (dialogid)" and when i add it, it gives errors "Undefined Symbol" GetClosestPlayerToPlayer.
|
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_ZCLASS:
{
if(!response) return ShowPlayerDialog(playerid,-1,0,"","","","");
if(response)
{
switch(listitem)// Checking which listitem was selected
{
case 0:
{
if(gTeam[playerid] == Zombie)
{
new id = GetClosestPlayerToPlayer(playerid);
new Float:x,Float:y,Float:z;
GetPlayerPos(id,x,y,z);
SetPlayerPos(playerid,x,z,z);
}
}
case 1:
{
//Whatever you want in case 1
}
}
}
}
}
}
#define DIALOG_ZCLASS 1
#define DIALOG_VCLASS 2
command(Class,playerid,params[])
{
if(gTeam[playerid] == Zombie)
{
ShowPlayerDialog(playerid, DIALOG_ZCLASS, DIALOG_STYLE_LIST, "Class Selection", "{FF0000}Bite(30HP)\n{00FF00}High Jump", "Select", "Cancle");
}
else if(gTeam[playerid] == Vampire)
{
ShowPlayerDialog(playerid, DIALOG_VCLASS, DIALOG_STYLE_LIST, "Class Selection", "{FF0000}Bite (30HP)\n{00FF00}Tp to nearest player", "Select", "Cancle");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_ZCLASS :
{
if(!response) return ShowPlayerDialog(playerid,-1,0,"","","","");
if(response)
{
switch(listitem)// Checking which listitem was selected
{
case 0:
{
new id = GetClosestPlayerToPlayer(playerid);
new Float:x,Float:y,Float:z;
GetPlayerPos(id,x,y,z);
SetPlayerPos(playerid,x,z,z);
}
case 1:
{
//Whatever you want in case 1
}
}
}
}
}
return 1;
}
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_ZCLASS:
{
if(!response) return ShowPlayerDialog(playerid,-1,0,"","","","");
if(response)
{
switch(listitem)
{
case 0:
{
if(gTeam[playerid] == Zombie)
{
new id = GetClosestPlayer(id);
new Float:x,Float:y,Float:z;
GetPlayerPos(id,x,y,z);
SetPlayerPos(playerid,x,z,z);
}
case 1:
{
}
}
}
}
return 1;
}
case DIALOG_VCLASS:
{
if(!response) return ShowPlayerDialog(playerid,-1,0,"","","","");
if(response)
{
switch(listitem)
{
case 0:
{
if(gTeam[playerid] == Vampire)
{
new id = GetClosestPlayer(id);
new Float:x,Float:y,Float:z;
GetPlayerPos(id,x,y,z);
SetPlayerPos(playerid,x,z,z);
}
case 1:
{
}
}
}
}
}
}
C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripter.pwn(533) : error 014: invalid statement; not in switch C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripter.pwn(533) : warning 215: expression has no effect C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripter.pwn(533) : error 001: expected token: ";", but found ":" C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripter.pwn(533) : error 029: invalid expression, assumed zero C:\Users\Pepsi\Desktop\Scripting\gamemodes\Scripter.pwn(533) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.