SA-MP Forums Archive
Little help... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Little help... (/showthread.php?tid=74639)



Little help... - Dr4cK - 24.04.2009

Hi

I'm new here and so as on pawno scripting...

I working on a /save and /load position script to my server and now I've reached the limit of what I can do so I want some help

Код:
 if (strcmp("/s", cmdtext, true, 10) == 0)
{
new Z[MAX_PLAYERS];
GetVehicleZAngle(playerid,Z[playerid]);
GetPlayerPos(playerid, ppx[playerid], ppy[playerid], ppz[playerid]);
SendClientMessage (playerid, COLOR_YELLOW, "Position Saved!");
return 1;
}
 if (strcmp("/l", cmdtext, true, 10) == 0)
 {
new Z[MAX_PLAYERS];
if(IsPlayerInAnyVehicle(playerid))
{
SetVehicleZAngle(playerid,Z[playerid]);
SetVehiclePos(GetPlayerVehicleID(playerid), ppx[playerid], ppy[playerid], ppz[playerid]);
}
else
{
SetPlayerPos(playerid, ppx[playerid], ppy[playerid], ppz[playerid]);
}
SendClientMessage (playerid, COLOR_YELLOW, "You have been teleported.");
return 1;
}
The problem is GetVehicleZAngle(playerid,Z[playerid]); I think cos it says like this in the compiler about it:

Код:
C:\Program\ROCKST~1\GTASAN~1\samp\GAMEMO~1\SeRVeR.pwn(1018) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Can anyone help me =) ?


Re: Little help... - Joe Staff - 24.04.2009

the new Z[MAX_PLAYERS] has to be Float:Z[MAX_PLAYERS] and has to be placed at the top of the script outside of any call backs


Re: Little help... - Dr4cK - 24.04.2009

Quote:
Originally Posted by SilentHuntR
the new Z[MAX_PLAYERS] has to be Float:Z[MAX_PLAYERS] and has to be placed at the top of the script outside of any call backs
Thx, solved the error, but the function itself didn't work in the game =/


Re: Little help... - OmeRinG - 24.04.2009

Show us the current code and how you declared the variables on top


Re: Little help... - Dr4cK - 24.04.2009

Quote:
Originally Posted by OmeRinG
Show us the current code and how you declared the variables on top
I did like this first, Putted the new Float:Z[MAX_PLAYERS]; on the top of the GM, gave me 4 wanrings, no function in-game so I tried to put it as before like this:

Код:
if (strcmp("/s", cmdtext, true, 10) == 0)
{
new Float:Z[MAX_PLAYERS];
GetVehicleZAngle(playerid,Z[playerid]);
GetPlayerPos(playerid, ppx[playerid], ppy[playerid], ppz[playerid]);
SendClientMessage (playerid, COLOR_YELLOW, "Position Saved!");
 return 1;
}
if (strcmp("/l", cmdtext, true, 10) == 0)
{
new Float:Z[MAX_PLAYERS];
if(IsPlayerInAnyVehicle(playerid))
{
SetVehicleZAngle(playerid,Z[playerid]);
SetVehiclePos(GetPlayerVehicleID(playerid), ppx[playerid], ppy[playerid], ppz[playerid]);
}
else
{
SetPlayerPos(playerid, ppx[playerid], ppy[playerid], ppz[playerid]);
}
SendClientMessage (playerid, COLOR_YELLOW, "You have been teleported.");
return 1;
}
no errors or warnings but still no function in-game.

Then I switched to this:

Код:
if (strcmp("/s", cmdtext, true, 10) == 0)
new Float:Z[MAX_PLAYERS];
{
GetVehicleZAngle(playerid,Z[playerid]);...
Код:
if (strcmp("/l", cmdtext, true, 10) == 0)
new Float:Z[MAX_PLAYERS];
{
if(IsPlayerInAnyVehicle(playerid))...
that gave me this result after compiling:
Код:
C:\Program\ROCKST~1\GTASAN~1\samp\GAMEMO~1\SeRVeR.pwn(1017) : error 003: declaration of a local variable must appear in a compound block
C:\Program\ROCKST~1\GTASAN~1\samp\GAMEMO~1\SeRVeR.pwn(1017) : warning 221: label name "Float" shadows tag name
C:\Program\ROCKST~1\GTASAN~1\samp\GAMEMO~1\SeRVeR.pwn(1017) : error 017: undefined symbol "Z"
C:\Program\ROCKST~1\GTASAN~1\samp\GAMEMO~1\SeRVeR.pwn(1017) : warning 215: expression has no effect
C:\Program\ROCKST~1\GTASAN~1\samp\GAMEMO~1\SeRVeR.pwn(1017) : error 001: expected token: ";", but found "]"
C:\Program\ROCKST~1\GTASAN~1\samp\GAMEMO~1\SeRVeR.pwn(1017) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Sry, but im a very shitty scripter, very new, started for about a week ago and I got the script from the net.