Only last teleport is working.
#1

If i'll create another one the prev one won't work, why?

pawn Код:
enum
e_TPInfo
{
Float:StartX,
Float:StartY,
Float:StartZ,
Float:EndX,
Float:EndY,
Float:EndZ
};
new TPInfo[MAX_TELEPORTS][e_TPInfo], tpid;
pawn Код:
CMD:createtp(playerid,params[]){
GetPlayerPos(playerid,pX,pY,pZ);
format(String,sizeof(String),"Teleport %i",DOF2_GetInt(TeleCount(playerid),"Count"));
Create3DTextLabel(String, -1, pX, pY, pZ, 10, 0, 0);
format(String,sizeof(String),"%i",DOF2_GetInt(TeleCount(playerid),"Count"));
DOF2_CreateFile(TeleFile(playerid));
DOF2_SetFloat(TeleFile(playerid),"StartX",TPInfo[tpid][StartX] = pX);
DOF2_SetFloat(TeleFile(playerid),"StartY",TPInfo[tpid][StartY] = pY);
DOF2_SetFloat(TeleFile(playerid),"StartX",TPInfo[tpid][StartZ] = pZ);
return 1;}

CMD:endtp(playerid,params[]){
GetPlayerPos(playerid,pX,pY,pZ);
format(String,sizeof(String),"Teleport %i",DOF2_GetInt(TeleCount(playerid),"Count"));
Create3DTextLabel(String, -1, pX, pY, pZ, 10, 0, 0);
DOF2_SetFloat(TeleFile(playerid),"EndX",TPInfo[tpid][EndX] = pX);
DOF2_SetFloat(TeleFile(playerid),"EndY",TPInfo[tpid][EndY] = pY);
DOF2_SetFloat(TeleFile(playerid),"EndX",TPInfo[tpid][EndZ] = pZ);
DOF2_SetInt(TeleCount(playerid),"Count",DOF2_GetInt(TeleCount(playerid),"Count")+1);
return 1;}

CMD:usetp(playerid,params[]){
if(IsPlayerInRangeOfPoint(playerid,2,TPInfo[tpid][StartX],TPInfo[tpid][StartY],TPInfo[tpid][StartZ])) return SetPlayerPos(playerid,TPInfo[tpid][EndX],TPInfo[tpid][EndY],TPInfo[tpid][EndZ]);
if(IsPlayerInRangeOfPoint(playerid,2,TPInfo[tpid][EndX],TPInfo[tpid][EndY],TPInfo[tpid][EndZ])) return SetPlayerPos(playerid,TPInfo[tpid][StartX],TPInfo[tpid][StartY],TPInfo[tpid][StartZ]);
return 1;}
pawn Код:
stock GetpName(playerid){
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
return pName;}

stock TeleCount(playerid){
GetPlayerScore(playerid);
format(String,sizeof(String),"Teleports/Count.ini");
return String;}

stock TeleFile(playerid){
GetPlayerScore(playerid);
format(String,sizeof(String),"Teleports/%i.ini",DOF2_GetInt(TeleCount(playerid),"Count"));
return String;}
Reply


Messages In This Thread
Only last teleport is working. - by Lirbo - 12.12.2014, 21:15
Re: Only last teleport is working. - by Mic_H - 12.12.2014, 21:36
Re: Only last teleport is working. - by Lirbo - 12.12.2014, 21:38
Re: Only last teleport is working. - by Lirbo - 13.12.2014, 07:54
Re: Only last teleport is working. - by Dziugsas - 13.12.2014, 08:07
Re: Only last teleport is working. - by Lirbo - 13.12.2014, 09:06
Re: Only last teleport is working. - by Lirbo - 13.12.2014, 22:13
Re: Only last teleport is working. - by Mic_H - 16.12.2014, 02:40

Forum Jump:


Users browsing this thread: 1 Guest(s)