04.09.2018, 11:11
It's just showing 1 item, here is my full code of /addgpslocation
Maybe having some problem on loop :/
PHP код:
COMMAND:addgpslocation(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Error: You are not authorized to use this command.");
new name[512];
if(sscanf(params, "s[512]", name)) return SendClientMessage(playerid, -1, "Usage: /addgpslocation [Name]");
for(new i=0;i<sizeof(GPS);i++)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x, y, z);
GPS[i][loc_name] = name;
GPS[i][loc_x] = x;
GPS[i][loc_y] = y;
GPS[i][loc_z] = z;
format(GPS[i][loc_name],512, "%s", name);
new query[256];
format(query, sizeof(query),"INSERT INTO gps (loc_x,loc_y,loc_z,loc_name) VALUES ('%f','%f','%f','%s')",GPS[i][loc_x],GPS[i][loc_y],GPS[i][loc_z],GPS[i][loc_z],GPS[i][loc_name]);
mysql_function_query(dbhandle,query,false,"","");
printf("%s || ID : %i", query,i);
printf("Pos : %f,%f,%f", x,y,z);
SendClientMessage(playerid, -1, "GPS: Location added successfully!");
return 1;
}
return 1;
}