29.05.2011, 16:28
Ive been working on a simple gamemode, Ive only been scripting for under 24hrs now.
Ive been shown ZCMD which is great.
But i cant seem to get two commands to work:
When i type "/tp 0" to Spawn to player 0 it should say "Spawning to Player_name"
but it just says "Spawning to 0"
CMD:tp(playerid,params[])
{
if (isnull(params)) {
SendClientMessage(playerid, COLOR_LIGHTBLUE1, "Usage: /tp [playerid]");
return 1;
}
else {
if (IsPlayerConnected(params[1])) {
new Float:X, Float:Y, Float:Z;
GetPlayerPos(params[0],X,Y,Z);
SetPlayerPos(playerid,X,Y,Z);
new name[128];
new string[128];
GetPlayerName(params[0],name, sizeof(name));
format(string, sizeof(string), "Spawning to %i", name);
SendClientMessage(playerid, COLOR_LIGHTBLUE1, string);
return 1;
}
else {
SendClientMessage(playerid, COLOR_LIGHTBLUE1, "No such user online.");
return 1;
}
}
}
Ive tried to make a /say command but instead of outputting the text entered in params[0] it just
outputs a number.
e.g. "/say Hello" Outputs "[Server]: 72"
CMDay(playerid,params[0])
{
if (isnull(params)) {
SendClientMessage(playerid, COLOR_LIGHTBLUE1, "Usage: /say [text]");
return 1;
}
else {
new string[128];
format(string, sizeof(string), "[SERVER]: %i", params[0]);
SendClientMessageToAll(0xFF9900AA, string);
return 1;
}
}
What have i done wrong?
Ive been shown ZCMD which is great.
But i cant seem to get two commands to work:
When i type "/tp 0" to Spawn to player 0 it should say "Spawning to Player_name"
but it just says "Spawning to 0"
CMD:tp(playerid,params[])
{
if (isnull(params)) {
SendClientMessage(playerid, COLOR_LIGHTBLUE1, "Usage: /tp [playerid]");
return 1;
}
else {
if (IsPlayerConnected(params[1])) {
new Float:X, Float:Y, Float:Z;
GetPlayerPos(params[0],X,Y,Z);
SetPlayerPos(playerid,X,Y,Z);
new name[128];
new string[128];
GetPlayerName(params[0],name, sizeof(name));
format(string, sizeof(string), "Spawning to %i", name);
SendClientMessage(playerid, COLOR_LIGHTBLUE1, string);
return 1;
}
else {
SendClientMessage(playerid, COLOR_LIGHTBLUE1, "No such user online.");
return 1;
}
}
}
Ive tried to make a /say command but instead of outputting the text entered in params[0] it just
outputs a number.
e.g. "/say Hello" Outputs "[Server]: 72"
CMDay(playerid,params[0])
{
if (isnull(params)) {
SendClientMessage(playerid, COLOR_LIGHTBLUE1, "Usage: /say [text]");
return 1;
}
else {
new string[128];
format(string, sizeof(string), "[SERVER]: %i", params[0]);
SendClientMessageToAll(0xFF9900AA, string);
return 1;
}
}
What have i done wrong?