SA-MP Forums Archive
GetVehicleModelID and array must be indexed - 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: GetVehicleModelID and array must be indexed (/showthread.php?tid=259363)



GetVehicleModelID and array must be indexed - Jack_Leslie - 04.06.2011

Here's my code:
Код:
if(strcmp(cmd, "/saveveh", true) == 0)
	{
 	if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,0x80000000,"Must be RCON admin to use this command");
    if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,0x80000000,"Must be inside a vehicle");
    new File:file,strtmp[128],Float:x,Float:y,Float:z,Float:a,vehid;
    file=fopen("AddStaticVehicle.txt",io_append);
    vehid=GetPlayerVehicleID(playerid);
    GetVehiclePos(vehid,x,y,z);
    GetVehicleZAngle(vehid,a);
    format(strtmp,128,"AddStaticVehicleEx(%d, %f, %f, %f, %f, -1, -1, -1);\n",GetVehicleModelID(vehid),x,y,z,a);
    fwrite(file,strtmp);
    fclose(file);
    return SendClientMessage(playerid,0x00800000,"Vehicle successfully saved.");
    }
    if(strcmp(cmd, "/savmypos", true) == 0)
	{
 if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,0x80000000,"Must be RCON admin to use this command");
    new File:file,strtmp[500],Float:x,Float:y,Float:z;
    file=fopen("SavedLocations.txt",io_append);
	PlayerPos=GetPlayerPos(playerid, x, y, z);
	GetPlayerPos(playerid, x, y, z);
    format(strtmp,500,"%f, %f, %f;\n",PlayerPos,x,y,z);
    fwrite(file,strtmp);
    fclose(file);
    return SendClientMessage(playerid,0x00800000,"On-foot cords saved.");
    }
Errors I get are:
Код:
(16426) : error 017: undefined symbol "GetVehicleModelID"
(16436) : error 033: array must be indexed (variable "PlayerPos")



Re: GetVehicleModelID and array must be indexed - Jeffry - 04.06.2011

pawn Код:
if(strcmp(cmd, "/saveveh", true) == 0)
{
    if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,0x80000000,"Must be RCON admin to use this command");
    if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,0x80000000,"Must be inside a vehicle");
    new File:file,strtmp[128],Float:x,Float:y,Float:z,Float:a,vehid;
    file=fopen("AddStaticVehicle.txt",io_append);
    vehid=GetPlayerVehicleID(playerid);
    GetVehiclePos(vehid,x,y,z);
    GetVehicleZAngle(vehid,a);
    format(strtmp,128,"AddStaticVehicleEx(%d, %f, %f, %f, %f, -1, -1, -1);\n",GetVehicleModel(vehid),x,y,z,a);
    fwrite(file,strtmp);
    fclose(file);
    return SendClientMessage(playerid,0x00800000,"Vehicle successfully saved.");
}
if(strcmp(cmd, "/savmypos", true) == 0)
{
    if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,0x80000000,"Must be RCON admin to use this command");
    new File:file,strtmp[500],Float:x,Float:y,Float:z;
    file=fopen("SavedLocations.txt",io_append);
    GetPlayerPos(playerid, PlayerPos[0], PlayerPos[1], PlayerPos[2]);
    GetPlayerPos(playerid, x, y, z);
    format(strtmp,500,"%f, %f, %f;\n",PlayerPos,x,y,z);
    fwrite(file,strtmp);
    fclose(file);
    return SendClientMessage(playerid,0x00800000,"On-foot cords saved.");
}
Try this.


Re: GetVehicleModelID and array must be indexed - Jack_Leslie - 04.06.2011

error 035: argument type mismatch (argument 2)

Between:
Код:
    GetPlayerPos(playerid, PlayerPos[0], PlayerPos[1], PlayerPos[2]);
    GetPlayerPos(playerid, x, y, z);



Re: GetVehicleModelID and array must be indexed - Jeffry - 04.06.2011

Can you show the 'new PlayerPos' please?