GetVehicleModelID and array must be indexed
#1

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")
Reply
#2

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.
Reply
#3

error 035: argument type mismatch (argument 2)

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

Can you show the 'new PlayerPos' please?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)