point name - 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)
+--- Thread: point name (
/showthread.php?tid=505473)
point name -
AhmedMohamed - 08.04.2014
it compile good but not working good at game.
pawn Код:
CMD:pedit(playerid, params[])
{
new String[128],
point,
name;
if(!strcmp(params, "name", true, 4))
{
if(sscanf(params, "s[32]is[32]", params, point, name)) return SendClientMessage(playerid, 0xFF0000AA, "[Usage]:{FFFFFF} /pedit name [pointid] [name]");
if(point < 1 || point > 6) return SendClientMessage(playerid, COLOR_GREY, "Points are between 1 and 6.");
format(String, sizeof(String), "AdmWarn: %s has Changed %s point name to %s", RPN(playerid), RPON(point), name);
SendAdminMessage(COLOR_DARKRED, 1, String);
DestroyDynamic3DTextLabel(PointInfo[point][pText]);
format(PointInfo[point][pName], 32, "%s", name);
format(String, sizeof(String),"Point name: %s\nCapture Time: %d Hours\nOwner: %s\nProfit: %d\n Type /capture to attempet to capture it.",RPON(point),PointInfo[point][pTime],RFaN(PointInfo[point][pOwner]),PointInfo[point][pProfit]);
PointInfo[point][pText] = CreateDynamic3DTextLabel(String, COLOR_YELLOW, PointInfo[point][pX], PointInfo[point][pY], PointInfo[point][pZ], 5);
}
return 1;
}
any errors??
Respuesta: point name -
Swedky - 08.04.2014
Yes, first you must use '
sscanf' and then check if the strings coincide... Remaining like that:
pawn Код:
CMD:pedit(playerid, params[])
{
new String[128], point, name;
if(sscanf(params, "s[32]is[32]", params[0], point, name)) return SendClientMessage(playerid, 0xFF0000AA, "[Usage]:{FFFFFF} /pedit name [pointid] [name]");
else if(strcmp(params[0], "name", true) == 0)
{
if(point < 1 || point > 6) return SendClientMessage(playerid, COLOR_GREY, "Points are between 1 and 6.");
format(String, sizeof(String), "AdmWarn: %s has Changed %s point name to %s", RPN(playerid), RPON(point), name);
SendAdminMessage(COLOR_DARKRED, 1, String);
DestroyDynamic3DTextLabel(PointInfo[point][pText]);
format(PointInfo[point][pName], 32, "%s", name);
format(String, sizeof(String),"Point name: %s\nCapture Time: %d Hours\nOwner: %s\nProfit: %d\n Type /capture to attempet to capture it.",RPON(point),PointInfo[point][pTime],RFaN(PointInfo[point][pOwner]),PointInfo[point][pProfit]);
PointInfo[point][pText] = CreateDynamic3DTextLabel(String, COLOR_YELLOW, PointInfo[point][pX], PointInfo[point][pY], PointInfo[point][pZ], 5);
}
return 1;
}
Also, As it will notice, I use '
param[0]' as variable.
Regards

.