Move 3DText
#1

Hi, i have a small problem , so when i use /movecas ( to move a 3D text + Pickup ) , they have some ID of factions that it's sayd me "You have specified invalid faction ID." and don't work, check my code

PHP код:
CMD:movecas(playeridparams[])
{
    static
        
id,
        
string[124],
        
Float:x,
        
Float:y,
        
Float:z,
        
query[124];
    
    if (
APlayerData[playerid][PlayerLevel] < 6) return 0;
    if (
sscanf(params"u"id))
        return 
SendClientMessage(playerid0xFF0000AA"[FORMAT CORRECT] /movecas [ID]");
     
    if ((
id < -|| id >= MAX_FACTIONS) || (id != -&& !Factions[id][factionExiste]))
        return 
SendClientMessage(playerid0xFF0000AA"You have specified invalid faction ID.");
    
GetPlayerPos(playeridxyz);
    
    
Factions[id][CasierPos][0] = x;
    
Factions[id][CasierPos][1] = y;
    
Factions[id][CasierPos][2] = z;
    
Factions[id][CasierInterior] = GetPlayerInterior(playerid);
    
Factions[id][CasierVW] = GetPlayerVirtualWorld(playerid);
    
mysql_format(g_iHandlequerysizeof(query), "UPDATE `factions` SET `CasierX` = '%4.2f', `CasierY` = '%4.2f', `CasierZ` = '%4.2f' WHERE `ID` = '%d'"xyzid);
    
mysql_tquery(g_iHandlequery);
    
Faction_Refresh(id);
    
    
format(stringsizeof(string), "\"%s\" has been replaced."Factions[id][FactionName]);
    
SendClientMessage(playerid0xFF0000AAstring);
    return 
1;

Reply
#2

If the "id" is 0, then it will return the error message. Also it might not be -1 but a value greater or equal to MAX_FACTIONS so you'd still get run time error 4. I can't think of any better way to do it currently so keep it double check.

pawn Код:
if (!(0 <= id < MAX_FACTIONS) || (0 <= id < MAX_FACTIONS && !Factions[id][factionExiste]))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)