02.06.2011, 11:08
(
Последний раз редактировалось nuriel8833; 02.06.2011 в 12:13.
)
Quote:
"tmp" is a string, you can't use it to index an array, only numbers can be used for that. I would strongly recommend using sscanf for this to extract the data out of the strings.
|
Damet
Edit: Can it work? This is the only solution I could possibly think of:
pawn Код:
if(strcmp(cmd, "/createlocation", true)==0 || strcmp(cmd, "/createloc", true)==0)
{
new str[128],tmp[256],location;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_USAGE,"USAGE: /createlocation [Location ID]");
if(tmp < 1 || tmp > 100) return SendClientMessage(playerid,COLOR_WARNING,"Warning: The location number must be between 1 to 100!");
new Float:X,Float:Y,Float:Z,Float:A,Interior;
new pName[MAX_PLAYER_NAME];
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,A);
Interior = GetPlayerInterior(playerid);
GetPlayerName(playerid, pName, sizeof(pName));
location = tmp;
LocInfo[location][LocX] = X;
LocInfo[location][LocY] = Y;
LocInfo[location][LocZ] = Z;
LocInfo[location][LocA] = A;
LocInfo[location][LocInterior] = Interior;
LocInfo[location][LocCreator] = pName;
format(str, 128, "You have succesfully set saved location %d to the following settings:",LocInfo[location][LocNumber]);
SendClientMessage(playerid, COLOR_BPINK, str);
format(str, 128, "Coordinations: %.2f,%.2f,%.2f",LocInfo[location][LocX],LocInfo[location][LocY],LocInfo[location][LocZ]);
SendClientMessage(playerid, COLOR_BPINK, str);
format(str, 128, "Angle: %.1f",LocInfo[location][LocA]);
SendClientMessage(playerid, COLOR_BPINK, str);
format(str, 128, "Interior: %d",LocInfo[location][LocInterior]);
SendClientMessage(playerid, COLOR_BPINK, str);
format(str, 128, "From now on people can teleport to this location by typing: /gotoloc [%d]",LocInfo[location][LocNumber]);
SendClientMessage(playerid, COLOR_BPINK, str);
PlayerPlaySound(playerid,1138,X,Y,Z);
SaveLocations();
return 1;
}
Thanks anyway ******