help me cant fix this
#1

Hi i made a commnads - teleports script but it dond work i don know why i get this errors and 2 warnings can somone help me whit it

C:\Documents and Settings\rafael\Bureaublad\teleports.pwn(315) : warning 217: loose indentation
C:\Documents and Settings\rafael\Bureaublad\teleports.pwn(317) : error 017: undefined symbol "PosX"
C:\Documents and Settings\rafael\Bureaublad\teleports.pwn(317) : warning 215: expression has no effect
C:\Documents and Settings\rafael\Bureaublad\teleports.pwn(317) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\rafael\Bureaublad\teleports.pwn(317) : error 029: invalid expression, assumed zero
C:\Documents and Settings\rafael\Bureaublad\teleports.pwn(317) : fatal error 107: too many error messages on one line


how i fix this

line 315 if (strcmp(cmdtext, "/savep", true)==0)
line 316 {
line 317 GetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
line 318 GetPlayerFacingAngle(playerid, PosA[playerid]);
line 319 SendClientMessage(playerid, COLOR_YELLOW, "Positon set! Go to this possiton with /loadp,");
line 320 PosI[playerid] = (GetPlayerInterior(playerid));
line 321 PlayerPlaySound(playerid, 1137 , 0.0, 0.0, 0.0);
line 322 return 1;
line 323 }
Reply
#2

The errors are on lines 315 and 317, and you've posted 277 lines of code.. spot the mistake?
Reply
#3

Quote:
Originally Posted by Weirdosport
The errors are on lines 315 and 317, and you've posted 277 lines of code.. spot the mistake?
how i fix the line 317

// fixed
Reply
#4

you can't directly save floats to strings. You have to use format e.g.
pawn Код:
new Float:x, Float:y, Float:z;//this is what we will first save the pos to
new string[128];//we will use this to transfer the pos to:
new PX[MAX_PLAYERS];//player's x pos
new PY[MAX_PLAYERS];//player's y pos
new PZ[MAX_PLAYERS];//player's z pos

GetVehiclePos(vehicleid,x,y,z);//Get Postion, saves to x,y,z
format(string,sizeof(string),"%f",x);//formats string's value to be x
PX[playerid]=strval(string);//sets PX's value to the value of the string
format(string,sizeof(string),"%f",y);//formats string's value to be y
PY[playerid]=strval(string);//sets PY's value to the value of the string
format(string,sizeof(string),"%f",z);//formats string's value to be z
PZ[playerid]=strval(string);//sets PZ's value to the value of the string
also are you sure you've got:
pawn Код:
new PosX[MAX_PLAYERS];
new PosY[MAX_PLAYERS];
new PosZ[MAX_PLAYERS];
new PosI[MAX_PLAYERS];
new PosA[MAX_PLAYERS];
At the start of the script?

Anyway, it should look like this:
pawn Код:
if (strcmp(cmdtext, "/savep", true)==0)
{
    new Float:x, Float:y, Float:z, Float:a, Float:i;
    new string[128];
   
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid, a);
   
    format(string,sizeof(string),"%f",x);
    PosX[playerid]=strval(string);
    format(string,sizeof(string),"%f",y);
    PosY[playerid]=strval(string);
    format(string,sizeof(string),"%f",z);
    PosZ[playerid]=strval(string);
    format(string,sizeof(string),"%f",a);
    PosA[playerid]=strval(string);
     PosI[playerid] = (GetPlayerInterior(playerid));
 
    SendClientMessage(playerid, COLOR_YELLOW, "Positon set! Go to this possiton with /loadp,");
    PlayerPlaySound(playerid,1137, 0.0, 0.0, 0.0);
    return 1;
}
Reply
#5

You shouldn't be saving the floats to strings, I think he's trying to save them to arrays, in which case you need to make them "float arrays"

pawn Код:
new Float:PX[MAX_PLAYERS];
//etc
Reply
#6

Quote:
Originally Posted by Weirdosport
You shouldn't be saving the floats to strings, I think he's trying to save them to arrays, in which case you need to make them "float arrays"

pawn Код:
new Float:PX[MAX_PLAYERS];
//etc
well i learnt something too :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)