if(strcmp(cmd, "/build", true) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /build [buildable]"), SendClientMessage(playerid, COLOR_GREY, "Objects: 1 [ Fence ]");
if(strval(tmp) == 1 || PlayerInfo[playerid][pMats] == 5)) // error 029: invalid expression, assumed zero
{
// Fence: 1141
new pos:X;
new pos:Y;
new pos:Z;
new object;
GetPlayerPos(strval(tmp), pos:X, pos:Y, pos:Z);
CreateObject(object, pos:X, pos:Y, pos:Z);
}
else // invalid expression, assumed zero Error
{
SendClientMessage(playerid, 0xFFFFFFFF, "Not enough mats Buddy!");
}
return 1;
}
error 022: must be lvalue (non-constant) error 001: expected token: ";", but found ")" rror 029: invalid expression, assumed zero fatal error 107: too many error messages on one line
if(strcmp(cmd, "/build", true) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /build [buildable]"), SendClientMessage(playerid, COLOR_GREY, "Objects: 1 [ Fence ]");
if(strval(tmp) == 1 || PlayerInfo[playerid][pMats] == 5)
{
// Fence: 1141
new Float:X;
new Float:Y;
new Float:Z;
GetPlayerPos(strval(tmp), Float:X, Float:Y, Float:Z);
CreateObject(3095, pos:X+1, pos:Y, pos:Z+1, 0, 0, 0, 100);
SendClientMessage(playerid, COLOR_GREY, "Built!");
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "Not Enough Mats!");
}
return 1;
}
Okay so it works now.. but The Object dosen't spawn ingame
PHP код:
|
if(strcmp(cmd, "/build", true) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /build [buildable]"), SendClientMessage(playerid, COLOR_GREY, "Objects: 1 [ Fence ]");
if(strval(tmp) == 1 || PlayerInfo[playerid][pMats] == 5)
{
// Fence: 1141
new Float:X;
new Float:Y;
new Float:Z;
GetPlayerPos(playerid, X, Y, Z); // Why were you getting the position of strval(tmp), that's only an 1/0 parameter :P
CreateObject(3095, X+1, Y, Z+1, 0, 0, 0, 100);
SendClientMessage(playerid, COLOR_GREY, "Built!");
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "Not Enough Mats!");
}
return 1;
}
if(strcmp(cmd, "/build", true) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /build [buildable]"), SendClientMessage(playerid, COLOR_GREY, "Objects: 1 [ Fence ]");
if(strval(tmp) == 1 || PlayerInfo[playerid][pMats] == 5)
{
// Fence: 1141
new Float:X;
new Float:Y;
new Float:Z;
GetPlayerPos(playerid, X, Y, Z);
CreateObject(strval(tmp), X+1, Y, Z+1, 0, 0, 0, 100);
SendClientMessage(playerid, COLOR_GREY, "Built!");
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "Not Enough Mats!");
}
return 1;
}
SetPlayerPos(playerid,coordx[random(sizeof(coordx))],coordy[random(sizeof(coordy))],coordz[random(sizeof(coordz))]
new coordx[] = // coordx
{
2010.1997,
2217.0286,
2008.1178,
1652.7507,
2019.7411
};
new coordy[] =
{
1158.7738,
2373.9978,
930.7737,
1652.7507,
1158.4047
};
new coordz[] =
{
10.8203,
10.6719,
10.8203,
10.6669,
10.6585
};
Instead of writing a whole new Thread I will just Comment here. :P
Im trying to make a random spawn system But I Need it to Randomly Choose the Spawn Coordinates. I Have some Code .. Код:
SetPlayerPos(playerid,coordx[random(sizeof(coordx))],coordy[random(sizeof(coordy))],coordz[random(sizeof(coordz))] Hard to explain but here it is. PHP код:
So Far Im Just getting destroyed by World Boundaries because they are random coords. :P |
new rand = random(sizeof(coordx)); SetPlayerPos(playerid,coordx[rand],coordy[rand],coordz[rand]);