12.12.2014, 21:15
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;}