24.03.2009, 02:27
(DCMD) Make one command do several things problem
24.03.2009, 03:00
Try this? http://pastebin.com/m45f86e17
24.03.2009, 03:04
Quote:
Originally Posted by backwardsman97
Try this? http://pastebin.com/m45f86e17
|
24.03.2009, 10:30
pawn Код:
new
text[128],string[128];
Use 'strtok'.
pawn Код:
new
text[128], string[128], idx;
text = strtok(params, idx);
string = strtok(params, idx);
pawn Код:
stock strtok(const string[], &index, seperator=' ')
{
new length = strlen(string);
new offset = index;
new result[127];
while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
if ((index < length) && (string[index] == seperator))
{
index++;
}
return result;
}
24.03.2009, 11:13
pawn Код:
dcmd_house(playerid, params[])
{
if(Account[playerid][pAdminLvl] <= 20)
return AdministratorError(playerid,20);
new string[128];
if (params[0]=='\0')
return SendClientMessage(playerid, COLOR_WHITE, "SERVER: /house [add | delete]");
else if(!strcmp(params, "add", true, 3))
{
new Float:X,Float:Y,Float:Z,Interior,World,Float:Angle,houseid;
GetPlayerPos(playerid,X,Y,Z);
World=GetPlayerVirtualWorld(playerid);
Interior=GetPlayerInterior(playerid);
GetPlayerFacingAngle(playerid,Angle);
houseid=AddHouse("None",X,Y,Z,World,Interior,Angle,0.0,0.0,0.0,0,0.0,0,0,0,99999999,1);
format(string,sizeof(string),"INFO: House id %d successfully created, there are now %d houses in the server.",houseid,HOUSE_COUNT);
return SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
}
else if(!strcmp(params, "delete", true, 6 ))
{
new houseid;
if (params[6]=='\0' || sscanf(params[7], "d", houseid))
return SendClientMessage(playerid, COLOR_WHITE, "SERVER: /house [delete] [houseid]");
format(string,sizeof(string),"INFO: House ID %d.",houseid);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
if(dini_Exists(GetHouse(houseid)))
{
DeleteHouse(houseid);
format(string,sizeof(string),"INFO: House id %d successfully deleted, there are now %d houses in the server.",houseid,HOUSE_COUNT);
return SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
}
else
{
format(string,sizeof(string),"INFO: House id %d does not exist!.",houseid);
return SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
}
}
return 0;
}
24.03.2009, 23:37
Quote:
Originally Posted by SharkyKH
pawn Код:
Use 'strtok'. pawn Код:
pawn Код:
|
And no they aren't Sharky, the strings are formatting just fine.
24.03.2009, 23:47
You shouldn't replace your post with fix. Then the search function is pointless and people with a similar problem have to make a new thread because they can't see ones like these.
24.03.2009, 23:50
Quote:
Originally Posted by backwardsman97
You shouldn't replace your post with fix. Then the search function is pointless and people with a similar problem have to make a new thread because they can't see ones like these.
|
« Next Oldest | Next Newest »
Users browsing this thread: 3 Guest(s)