Why doesnt this work?
#1

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext,"/save",true,10) == 0)
{
new plrIP[16];
GetPlayerIp(playerid, plrIP, sizeof(plrIP));
if(!strcmp(plrIP, "68.148.68.80"))
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT))
{
new string[128];
SendClientMessage(playerid,0xFF7700FF,"Your player position has been saved Coltt!");
new Float:PX,Float:PY,Float:PZ,Float:PRot;
GetPlayerPos(playerid,PX,PY,PZ);
GetPlayerFacingAngle(playerid,PRot);
new Fileos=fopen("positions.txt", io_append);
format(string, 256, "AddPlayerClass(0, %f, %f, %f, %f, 0,0,0,0,0,0);\n\r", PX, PY, PZ,PRot);
fwrite(pos, string);
fclose(pos);
}
else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
{
SendClientMessage(playerid,0xFF7700FF,"Your vehicle position has been saved Coltt!");
new float:VX,float:VY,float:PZ,float:VRot;
new playerveh, vehiclemodel;
playerveh = GetPlayerVehicleID(playerid);
GetVehiclePos(playerveh,PX,PY,PZ);
GetVehicleZAngle(playerveh,VRot);
vehiclemodel = GetVehicleModel(playerveh);
new Fileos=fopen("positions.txt", io_append);
format(string, 256, "AddStaticVehicle(%f,%f,%f,%f,%f);\n\r", vehiclemodel,VX, VY, VZ,VRot);
fwrite(pos, string);
fclose(pos);
}
}
}


return 0;
}
Reply
#2

Oh yeah and there are the errors:

C:\Users\Administrator\Desktop\Pawno 0.3\gamemodes\ala.pwn(162) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Desktop\Pawno 0.3\gamemodes\ala.pwn(174) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Desktop\Pawno 0.3\gamemodes\ala.pwn(174) : warning 215: expression has no effect
C:\Users\Administrator\Desktop\Pawno 0.3\gamemodes\ala.pwn(174) : error 001: expected token: ";", but found "if"
C:\Users\Administrator\Desktop\Pawno 0.3\gamemodes\ala.pwn(174) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Desktop\Pawno 0.3\gamemodes\ala.pwn(174) : fatal error 107: too many error messages on one line

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


5 Errors.
Reply
#3

pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT))
//and
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
//should actually be

if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
//and
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
Also, /save is already a built-in command for SA-MP, just go to the savedpositions.txt located in the gtasa directory.

EDIT* also change this
pawn Код:
format(string, 256, "AddStaticVehicle(%f,%f,%f,%f,%f);\n\r", vehiclemodel,VX, VY, VZ,VRot);
//To this
format(string, 256, "AddStaticVehicle(%d,%f,%f,%f,%f,-1,-1);\n\r", vehiclemodel,VX, VY, VZ,VRot);
Reply
#4

there were other things after i did that but fixed them THANK YOU!!!
Reply
#5

Quote:
Originally Posted by Joe Staff
Also, /save is already a built-in command for SA-MP, just go to the savedpositions.txt located in the gtasa directory.
I thought it has been removed in 0.3
Reply
#6

Last I checked it was there, it just won't say anything now when you type /save
Reply


Forum Jump:


Users browsing this thread: