13.03.2015, 20:58
(
Последний раз редактировалось JoshNudock; 02.05.2015 в 18:08.
)
#include a_samp
forward FuncaoGangZone(playerid, TypeOrg, NameGZ[]);
public FuncaoGangZone(playerid, TypeOrg, NameGZ[]){
for (new i; i < MAX_PLAYERS; i++){
if(TypeOrg == 1){
// Org 01
}
else if(TypeOrg == 2){
// Org 02
}
else if(TypeOrg == 2){
// Org 03
}
}
return 1;
}
FuncaoGangZone(playerid, GetPlayerOrg(playerid), "Nome da GZ"); //Na hora que chama a funзгo
Lembre-se: Quando se for escrever uma string( ou seja, que tenha caracteres ) deve se usar [] como visto acima. Abraзos
|
Utilizar switch й bem mais viбvel.
|
new string[128];
if (NameGZ == TypeOrg) //aqui tб o erro :/
FuncaoGangZone(playerid, GetPlayerOrg(playerid), "GZIdlewooddono"); //chama a funзгo
FuncaoGangZone(playerid, GetPlayerOrg(playerid), "gzLasColinasdono"); //chama a funзгo
if (GZIdlewooddono == TypeOrg)
{
format(string, sizeof(string), "ERRO: Este territуrio jб pertence a sua %s.", Org(playerid));
return SendClientMessage(playerid, COLOR_GRAD1, string);
}
if (gzLasColinasdono == TypeOrg)
{
format(string, sizeof(string), "ERRO: Este territуrio jб pertence a sua %s.", Org(playerid));
return SendClientMessage(playerid, COLOR_GRAD1, string);
}
C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\123.pwn(2311) : error 033: array must be indexed (variable "NameGZ") C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\123.pwn(2321) : error 033: array must be indexed (variable "NameGZ") C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\123.pwn(2329) : error 033: array must be indexed (variable "NameGZ") C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\123.pwn(2337) : error 033: array must be indexed (variable "NameGZ") C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\123.pwn(2345) : error 033: array must be indexed (variable "NameGZ") C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\123.pwn(2353) : error 033: array must be indexed (variable "NameGZ") C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\123.pwn(2361) : error 033: array must be indexed (variable "NameGZ") C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\123.pwn(2369) : error 033: array must be indexed (variable "NameGZ") Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 13 Errors.
forward FuncaoGangZone(playerid, TypeOrg, NameGZ[]);
public FuncaoGangZone(playerid, TypeOrg, NameGZ[])
if (NameGZ[] == TypeOrg)
{
format(string, sizeof(string), "ERRO: Este territуrio jб pertence a sua %s.", Org(playerid));
return SendClientMessage(playerid, COLOR_GRAD1, string);
}
C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\BSL.pwn(2299) : error 029: invalid expression, assumed zero C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\BSL.pwn(2309) : error 029: invalid expression, assumed zero C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\BSL.pwn(2317) : error 029: invalid expression, assumed zero C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\BSL.pwn(2325) : error 029: invalid expression, assumed zero C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\BSL.pwn(2333) : error 029: invalid expression, assumed zero C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\BSL.pwn(2341) : error 029: invalid expression, assumed zero C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\BSL.pwn(2349) : error 029: invalid expression, assumed zero C:\Documents and Settings\P.Henrique\Desktop\gamemode\gamemodes\BSL.pwn(2357) : error 029: invalid expression, assumed zero
if ("NameGZ" == TypeOrg)
{
format(string, sizeof(string), "ERRO: Este territуrio jб pertence a sua %s.", Org(playerid));
return SendClientMessage(playerid, COLOR_GRAD1, string);
}
//A enumeraзгo irб enumerar as gangzones por ordem, comeзa no 0
enum
{
GANGZONE_PARQUE, //0
GANGZONE_HOSPITAL, //1
GANGZONE_MORRO, //2
GANGZONE_AREA51 //3
}
forward FuncaoGangZone(playerid, org, GangZone);
//playerid - id do jogador
//org - organizaзгo
//GangZone - Serб o valor da gangzone, ou seja, 0 seria GANGZONE_PARQUE
FuncaoGangZone(playerid, GetPlayerOrg(playerid), GANGZONE_PARQUE); //Chamamos a callback
public FuncaoGangZone(playerid, org, GangZone)
{
switch(GangZone) //utilizamos switch pois estamos a trabalhar com condiзхes sequкncias, ou seja, 0,1,2,3 й melhor que o if
{
case GANGZONE_PARQUE:
{
//colocamos aqui o cуdigo..
}
case GANGZONE_HOSPITAL:
{
}
case GANGZONE_MORRO:
{
}
case GANGZONE_AREA51:
{
}
}
}
PHP Code:
|
FuncaoGangZone(playerid, GetPlayerOrg(playerid), "GZIdlewooddono");
forward FuncaoGangZone(playerid, TypeOrg, NameGZ[]);
public FuncaoGangZone(playerid, TypeOrg, NameGZ[])
if ("NameGZ" == ?)
if ("NameGZ" == TypeOrg)
{
format(string, sizeof(string), "ERRO: Este territуrio jб pertence a sua %s.", Org(playerid));
return SendClientMessage(playerid, COLOR_GRAD1, string);
}
if ("NameGZ" == 1)
{
if (GetPlayerOrg(i) == 1)
{
format(string, 256, "* %s estгo tentando conquistar %s.", NomeORG(playerid), GetZone(X, Y, Z));
SendClientMessage(i, 0x00A5FFFF, string);
}
}
else if ("NameGZ" == 2)
{
if (GetPlayerOrg(i) == 2)
{
format(string, 256, "* %s estгo tentando conquistar %s.", NomeORG(playerid), GetZone(X, Y, Z));
SendClientMessage(i, 0x00A5FFFF, string);
}
}
else if ("NameGZ" == 5)
{
if (GetPlayerOrg(i) == 5)
{
format(string, 256, "* %s estгo tentando conquistar %s.", NomeORG(playerid), GetZone(X, Y, Z));
SendClientMessage(i, 0x00A5FFFF, string);
}
}
else if ("NameGZ" == 12)
{
if (GetPlayerOrg(i) == 12)
{
format(string, 256, "* %s estгo tentando conquistar %s.", NomeORG(playerid), GetZone(X, Y, Z));
SendClientMessage(i, 0x00A5FFFF, string);
}
}
else if ("NameGZ" == 15)
{
if (GetPlayerOrg(i) == 15)
{
format(string, 256, "* %s estгo tentando conquistar %s.", NomeORG(playerid), GetZone(X, Y, Z));
SendClientMessage(i, 0x00A5FFFF, string);
}
}
else if ("NameGZ" == 16)
{
if (GetPlayerOrg(i) == 16)
{
format(string, 256, "* %s estгo tentando conquistar %s.", NomeORG(playerid), GetZone(X, Y, Z));
SendClientMessage(i, 0x00A5FFFF, string);
}
}
if(x == 1)
if(x == y)