#1

I'm doing real estate and somehow I can't fix this how?

PHP код:
OnDialogResponse
new var1 GetPlayerNehnutelnost(playerid);
new 
var2 PlayerIDs(NehnutelnostInfo[var1][Owner]); 
PHP код:
stock PlayerIDs(string)   ///warning 203: symbol is never used: "string"
{
    for(new 
070g++)
    {
        if(
IsPlayerConnected(g))
        {
            new 
name[24];
            
GetPlayerName(gname24);
            if(!
strcmp(namestringtrue)) /// error 035: argument type mismatch (argument 2)
            
{
                return 
g;
            }
        }
    }
    return -
1;

Reply
#2

pawn Код:
stock PlayerIDs(string[])  
{
    for(new g = 0; g < 70; g++)
    {
        if(IsPlayerConnected(g))
        {
            new name[24];
            GetPlayerName(g, name, 24);
            if(!strcmp(name, string, true))
            {
                return g;
            }
        }
    }
    return -1;
}
Reply
#3

Код:
stock PlayerIDs(string); // This value is not a string, it's integer 
stock PlayerIDs(const string[]); // This value is a string
I think you wanted to know that is given name player is connected or not, for that use this

Код:
stock bool:IsPlayerConnected(const string[])
{
    foreach(new i: Player)
    {
        new name[50];
        GetPlayerName(playerid, name[], sizeof name);
        if(!strcmp(name, string)) return true;
    }
    return false;
}
Reply
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
What does this have to do with stock?
I can't even explain it myself


just that I have a problem with other things... when I press the left alt, nothing will show me
PHP код:

#include <a_samp>
#include <Double-O-Files_2>
#define MAX_NEHNUTELNOST 30
#define MAX_PLAYERS_EX 100
#define DIALOG_NEHNUTELNOST     39
#define DIALOG_NEHNUTELNOST01   40
new Ochranka[MAX_PLAYERS_EX];
new 
Vysloto[MAX_PLAYERS_EX];
new 
Nastavcas20[MAX_PLAYERS_EX];
new 
Obchodik[MAX_PLAYERS_EX];
new 
coze[MAX_PLAYERS_EX];
new 
NehnutelnostCount = -1;
enum PINFO
{
Job
};
new 
PlayerInfo[MAX_PLAYERS_EX][PINFO]; //prбca
enum NEHNUTELNOST_DATA
{
    
Nazev[100],
    
Float:pX,
    
Float:pY,
    
Float:pZ,
    
Owner[21],
    
Text3D:Text,
    
Pickup,
    
Vydelek,
    
vzs,
    
Cena
}
new 
NehnutelnostInfo[MAX_NEHNUTELNOST][NEHNUTELNOST_DATA];
public 
OnGameModeInit()
{
    
AddNehnutelnost("Stadion",2729.5010,-1828.0511,11.8438,5000000,0); // nehnutelnost stadion
    
AddNehnutelnost("Kuracinec",371.6662,-6.4647,1001.8589,5000000,0); // nehnutelnost Kuracinec
    
AddNehnutelnost("PIZZA",377.9117,-119.0545,1001.4922,5000000,0); // nehnutelnost Pizza
    
AddNehnutelnost("KADERNICTVO",411.8493,-50.5018,1001.8984,5000000,0); // nehnutelnost kadernictvo
    
AddNehnutelnost("TATTO",-201.6050,-26.2530,1002.2734,5000000,0); // nehnutelnost tatto
    
AddNehnutelnost("SEXSHOP",-105.7039,-11.1494,1000.7188,5000000,0); // nehnutelnost sexshop
    
AddNehnutelnost("ZIP",161.4852,-84.3136,1001.8047,5000000,0); // nehnutelnost zip
    
AddNehnutelnost("BAR",491.0402,-81.3901,998.7578,5000000,0); // nehnutelnost bar
    
AddNehnutelnost("BINCO",207.1654,-97.7527,1005.2578,5000000,0); // nehnutelnost binco
    
AddNehnutelnost("GYM",756.3207,11.5378,1000.7017,5000000,0); // nehnutelnost GYM
    
return 1;
}
stock AddNehnutelnost(nehText[],Float:nX,Float:nY,Float:nZ,CENA,VZS)
{
    
NehnutelnostCount++;
    if(
NehnutelnostCount MAX_NEHNUTELNOST)
    {
        print(
"Byl prekrocen maximalni pocet nehnutelnosti");
        
SendRconCommand("exit");
    }
    else
    {
        
format(NehnutelnostInfo[NehnutelnostCount][Nazev], 100"%s"nehText);
        
NehnutelnostInfo[NehnutelnostCount][pX] = nX;
        
NehnutelnostInfo[NehnutelnostCount][pY] = nY;
        
NehnutelnostInfo[NehnutelnostCount][pZ] = nZ;
        
NehnutelnostInfo[NehnutelnostCount][Cena] = CENA;
        
NehnutelnostInfo[NehnutelnostCount][vzs] = VZS;
        
NehnutelnostInfo[NehnutelnostCount][Pickup] = CreatePickup(1277,1,nXnYnZ);
        new 
s[25],str[200];
        
format(s,25,"VRLS/Nehnutelnosti/%d.cfg",NehnutelnostCount);
        if(!
fexist(s))
        {
            
DOF2_CreateFile(s);
            
DOF2_SetString(s,"Owner","Mesto");
            
format(str,200,"{FFFF00}%s\r\n{00FF00}Majitel: {FFFFFF}Město\r\n{00FF00}Cena: {FFFFFF}%d{33AA33}$\r\n{00FF00}VZS: {FFFFFF}%d{33AA33}$",nehText,CENA,VZS);
            
NehnutelnostInfo[NehnutelnostCount][Text] = Create3DTextLabel(str,4042260650,nX,nY,nZ+1,50,0);
        }
        else
        {
            if(
IsNehnutelnostForSale(NehnutelnostCount))
            {
                
format(str,200,"{FFFF00}%s\r\n{00FF00}Majitel: {FFFFFF}Město\r\n{00FF00}Cena: {FFFFFF}%d{33AA33}$\r\n{00FF00}VZS: {FFFFFF}%d{33AA33}$",nehText,CENA,VZS);
                
NehnutelnostInfo[NehnutelnostCount][Text] = Create3DTextLabel(str,4042260650,nX,nY,nZ+1,50,0);
            }
            else
            {
                
format(str,200,"{FFFF00}%s\r\n{00FF00}Majitel: {FFFFFF}%s\r\n{00FF00}Cena: {FFFFFF}%d{33AA33}$\r\n{00FF00}VZS: {FFFFFF}%d{33AA33}$",nehText,DOF2_GetString(s,"Owner"),CENA,VZS);
                
NehnutelnostInfo[NehnutelnostCount][Text] = Create3DTextLabel(str,4042260650,nX,nY,nZ+1,50,0);
            }
        }
    }
    return 
NehnutelnostCount;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
IsPlayerConnected(playerid))
    {
        if(
newkeys == KEY_WALK)
        {
            for(new 
0NehnutelnostCountz++)
            {
                if(
IsPlayerInRangeOfPoint(z2NehnutelnostInfo[NehnutelnostCount][pX], NehnutelnostInfo[NehnutelnostCount][pY], NehnutelnostInfo[NehnutelnostCount][pZ]) == 1)
                {
                    if(!
coze[z])
                    {
                        
ShowPlayerDialog(playerid,DIALOG_NEHNUTELNOST,DIALOG_STYLE_LIST,"Nehnutelnost","Zбrobky\n Koupit\n Prodat\n Vybrat vэdělek\n Investice\n Ochranka\n Vykrбst","Enter","Koniec");
                        
coze[z] = 1;
                    }
                    new 
var1[200];
                    
format(var1200"~b~~h~Business ~w~%s ~n~~b~~h~Cena: ~w~%d$ ~n~~b~~h~Majitel: ~w~%s"NehnutelnostInfo[NehnutelnostCount][Nazev], NehnutelnostInfo[NehnutelnostCount][Cena], NehnutelnostInfo[playerid][Owner]);
                    
GameTextForPlayer(zvar150001);
                }
            }
        }
    }
    return 
1;
}
    
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch (
dialogid)
    {
        case 
DIALOG_NEHNUTELNOST:
        {
            if(
response == 1)
            {
                
TogglePlayerControllable(playeridtrue);
                
coze[playerid] = 0;
                new 
var1 GetPlayerNehnutelnost(playerid);
                new 
var2 PlayerIDs(NehnutelnostInfo[var1][Owner]);
                if(
listitem == 0)
                {
                    new 
var3[128];
                    
format(var3128"Nemovitost %s ma prumerny vydelek %d$"NehnutelnostInfo[var1][Nazev], NehnutelnostInfo[var1][Cena] / 100);
                    
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var33000);
                }
                if(
listitem == 1)
                {
                    if(
var2 != playerid)
                    {
                        if(
NehnutelnostInfo[var1][Cena] <= GetPlayerMoney(playerid))
                        {
                            if(!
Ochranka[var1])
                            {
                                new 
var3[128];
                                
format(var3128"Odkoupil jste nemovitost %s od vlastnika: %s"NehnutelnostInfo[var1][Nazev], PlayerName(playerid));
                                
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var33000);
                                
Vysloto[playerid] = 0;
                                if(
IsPlayerConnected(var2))
                                {
                                    
GivePlayerMoney(var2NehnutelnostInfo[var1][Cena]);
                                }
                                
GivePlayerMoney(playerid,-NehnutelnostInfo[var1][Cena]);
                                new 
cesta[25];
                                
format(cesta,25,"VRLS/Nehnutelnosti/%d.cfg",var1);
                                
DOF2_SetString(cesta,"Owner",PlayerName(playerid));
                                
DOF2_Exit();
                                if(
IsPlayerConnected(var2))
                                {
                                    
format(var3128"[ ! ] Hrac %s(%d) vam odkoupil nemovitost %s"PlayerName(playerid), playeridNehnutelnostInfo[var1][Nazev]);
                                    
SendClientMessage(var20xEFEFF7AAvar3);
                                    
format(var3128"Nemovitost byla odkoupena za %d$ a nevyzvednute penize byly zabaveny mestem"NehnutelnostInfo[var1][Cena]);
                                    
SendClientMessage(var20xEFEFF7AAvar3);
                                }
                                new 
str[200];
                                
format(str,200,"{FFFF00}%s\r\n{00FF00}Majitel: {FFFFFF}%s\r\n{00FF00}Vэdělek: {FFFFFF}%d{33AA33}$",NehnutelnostInfo[var1][Nazev],PlayerName(playerid),NehnutelnostInfo[var1][Vydelek]);
                                
Update3DTextLabelText(NehnutelnostInfo[var1][Text],0xFF0000FF,str);
                            }
                            else
                            {
                                
//function4CC0(playerid, 349492);
                                
ApplyAnimation(playerid"CRACK""crckdeth4"4.00114, -1);
                            }
                        }
                        else
                        {
                            new 
var3[128];
                            
format(var3128"Nemate dostatek penez pro koupeni %s.Je zapotrebi nejmene %d$"NehnutelnostInfo[var1][Nazev],NehnutelnostInfo[var1][Cena]);
                            
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var33000);
                        }
                    }
                    else
                    {
                        
FormatPlayerInfoBox(playerid,"~g~Nehnutelnost""Ty nie si majitelom tento nehnutelnosti",4000);
                    }
                }
                if(
listitem == 2)
                {
                    if(
var2 == playerid)
                    {
                        new 
cesta[25];
                        
format(cesta,25,"VRLS/Nehnutelnosti/%d.cfg",var1);
                        
DOF2_SetString(cesta,"Owner","Mesto");
                        
DOF2_Exit();
                        
GivePlayerMoney(playerid,NehnutelnostInfo[var1][Cena]);
                        new 
var3[200];
                        
format(var3200"Predali ste nemovitost ~r~%s. ~w~ Bolo vбm vrбtenй %d$"NehnutelnostInfo[var1][Nazev], NehnutelnostInfo[var1][Cena]);
                        
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var33000);
                        new 
str[200];
                        
format(str,200,"{FFFF00}%s\r\n{00FF00}Majitel: {FFFFFF}Město\r\n{00FF00}Cena: {FFFFFF}%d{33AA33}$\r\n{00FF00}VZS: {FFFFFF}%d{33AA33}$",NehnutelnostInfo[var1][Nazev],NehnutelnostInfo[var1][Cena],NehnutelnostInfo[var1][vzs]);
                        
Update3DTextLabelText(NehnutelnostInfo[var1][Text],0xFF0000FF,str);
                        
format(NehnutelnostInfo[playerid][Owner], 64"Mesto");
                    }
                    else
                    {
                        new 
var3[128];
                        
format(var3128"Nie si vlastnikom tento nehnutelnosti %s"NehnutelnostInfo[var1][Nazev]);
                        
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var33000);
                    }
                }
                if(
listitem == 3)
                {
                    if(
playerid == var2)
                    {
                        if(
Vysloto[playerid])
                        {
                            new 
var3[200];
                            new 
Float:VydelkovySystem floatround(random((Vysloto[playerid] / 7) + 100), 0);
                            
format(var3200"Nemovitost %s ma v trezoru %d$,bylo strzeno %d$ na udrzbu a vyplaty zamestnancu. Penize vam byly vyplaceny"NehnutelnostInfo[var1][Nazev], Vysloto[playerid] - VydelkovySystemVydelkovySystem);
                            
SendClientMessage(var20xEFEFF7AAvar3);
                            
VydelkovySystem Vysloto[playerid] - VydelkovySystem;
                              
GivePlayerMoney(playeridVydelkovySystem);
                            
Vysloto[playerid] = 0;
                        }
                        else
                        {
                            
SendClientMessage(playerid0xEFEFF7AA"Nemovitost nic nevydelala");
                        }
                    }
                    else
                    {
                        new 
var31[128];
                        
format(var31128"Nie si vlastnikom tento nehnutelnosti %s"NehnutelnostInfo[var1][Nazev]);
                        
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var313000);
                    }
                }
                if(
listitem == 4)
                {
                    if(
playerid == var2)
                    {
                        
coze[playerid] = 1;
                        
ShowPlayerDialog(playeridDIALOG_NEHNUTELNOST01DIALOG_STYLE_INPUT"Nehnutelnost - Investicia""Sme zadajte sumu akъ chcete zainvestovat""Enter""Zpдť");
                    }
                    else
                    {
                        new 
var31[128];
                        
format(var31128"Nie si vlastnikom tento nehnutelnosti %s"NehnutelnostInfo[var1][Nazev]);
                        
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var313000);
                    }
                }
                if(
listitem == 5)
                {
                    if(
playerid == var2)
                    {
                        if(
NehnutelnostInfo[var1][Vydelek] / GetPlayerMoney(playerid))
                        {
                            if(!
Ochranka[playerid])
                            {
                                new 
var3[200];
                                
format(var3200"Nemovitost %s je nyni hlidana ochrankou, po dobu dalsich 60 minut. Zaplatil jste %d$",  NehnutelnostInfo[var1][Nazev], floatround(NehnutelnostInfo[var1][Vydelek] / 400));
                                
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var33000);
                                
Ochranka[playerid] = Ochranka[playerid] + 60;
                                
GivePlayerMoney(playeridfloatround(- (NehnutelnostInfo[var1][Vydelek] / 40), 0));
                            }
                            else
                            {
                                
SendClientMessage(playerid0xEFEFF7AA"[ ! ] Nemovitost uz je pod ochranou");
                            }
                        }
                        else
                        {
                            new 
var31[128];
                            
format(var31128"Nemate na zaplaceni %d$ za ochranku"floatround(NehnutelnostInfo[var1][Vydelek] / 40));
                            
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var313000);
                        }
                    }
                    else
                    {
                        new 
var31[128];
                        
format(var31128"Nie si vlastnikom tento nehnutelnosti %s"NehnutelnostInfo[var1][Nazev]);
                        
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var313000);
                    }
                }
                if(
listitem == 6)
                {
                    if(
playerid != var2)
                    {
                        if(
Obchodik[playerid])
                        {
                            
FormatPlayerInfoBox(playerid,"~g~Nemovitost","Pred nedavno si tuto nemovitost vykradol"3000);
                        }
                        else if(
Ochranka[playerid])
                        {
                            
FormatPlayerInfoBox(playerid,"~g~Nemovitost","Nemovitosť je pod ochrankou"3000);
                        }
                        else if(
Nastavcas20[playerid])
                        {
                            
FormatPlayerInfoBox(playerid,"~g~Nemovitost","bфah bфah bфah"3000);
                        }
                        else if(!
GetPlayerWeapon(playerid))
                        {
                            
FormatPlayerInfoBox(playerid,"~g~Nemovitost","~r~ Pre vkradnutie potrebujeљ ~r~~h~zbran!!!"3000);
                        }
                        else
                        {
                            
Nastavcas20[playerid] = 20;
                            
SetTimerEx("obchod"1000false"i"playerid);
                            
ApplyAnimation(playerid"SHOP""ROB_Loop_Threat"5.511111);
                            
SetPlayerWantedLevel(playeridGetPlayerWantedLevel(playerid) + 1);
                            for(new 
ids 0ids 70ids++)
                            {
                                if(
IsPlayerConnected(ids))
                                {
                                    if(
PlayerInfo[ids][Job] == 14 || PlayerInfo[ids][Job] == 10)
                                    {
                                        new 
var4[128];
                                        
format(var4128"[ ! ] Zloděj %s vykrбdб obchod %s"PlayerName(playerid), NehnutelnostInfo[var1][Nazev]);
                                        
SendClientMessage(playerid0x7171FFAAvar4);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        
FormatPlayerInfoBox(playerid,"~g~Nehnutelnost""Nemozes si vyhradnut vlastnu nehnutelnost",4000);
                    }
                }
            }
        }
        case 
DIALOG_NEHNUTELNOST01:
        {
            if(
response == 1)
            {
                  new 
var1 GetPlayerNehnutelnost(playerid);
                
TogglePlayerControllable(playeridtrue);
                
coze[playerid] = 0;
                if(
var1 == -1)
                {
                    return 
SendClientMessage(playerid0xEFEFF7AA"[ ! ] Musite byt u nemovitosti");
                }
                if(
GetPlayerMoney(playerid) < 10000)
                {
                    
SendClientMessage(playerid0xEFEFF7AA"nemбљ 10000");
                }
                else
                {
                    
NehnutelnostInfo[var1][Vydelek] = NehnutelnostInfo[var1][Vydelek] + 10000;
                    
SendClientMessage(playerid0xEFEFF7AA"dal si 10000");
                }
            }
            if(
response == 0)
            {
                
ShowPlayerDialog(playerid,DIALOG_NEHNUTELNOST,DIALOG_STYLE_LIST,"Nehnutelnost","Zбrobky\n Koupit\n Prodat\n Vybrat vэdělek\n Investice\n Ochranka\n Vykrбst","Enter","Koniec");
            }
        }
    }
    return 
1;
}
forward obchod(playerid);
public 
obchod(playerid)
{
    if(
IsPlayerConnected(playerid))
    {
        if(
Nastavcas20[playerid])
        {
            new 
var0[128];
            
format(var0128"~n~~n~~n~~n~~n~~n~~n~~n~~n~~r~Cas vykradani : ~w~%d"20);
            
GameTextForPlayer(playeridvar011003);
            
Nastavcas20[playerid]--;
            
SetTimerEx("obchod"1000false"i"playerid);
        }
        else
        {
            for(new 
g=0;g<NehnutelnostCount;g++)
            {
                if(
IsPlayerInRangeOfPoint(playerid,2,NehnutelnostInfo[g][pX],NehnutelnostInfo[g][pY],NehnutelnostInfo[g][pZ]) ==1)
                {
                    if(
Obchodik[playerid] == 1)
                    {
                        
SendClientMessageToAll(0xFF0000AA"tento obchod si uћ vykradol");
                    }
                    else
                    {
                        new 
var1[128];
                        
GivePlayerMoney(playerid,NehnutelnostInfo[g][Vydelek]/4);
                        
NehnutelnostInfo[g][Vydelek] = NehnutelnostInfo[g][Vydelek]/4;
                        
SetPlayerWantedLevel(playeridGetPlayerWantedLevel(playerid) + 1);
                        
format(var1128"[ NEWS.COM ] Zloděj %s přepadl %s se zbranн %s, ukradl %d$"PlayerName(playerid), NehnutelnostInfo[g][Nazev], GetWeaponSlot(GetPlayerWeapon(playerid)), NehnutelnostInfo[g][Vydelek]);
                        
SendClientMessageToAll(0xFF0000AAvar1);
                        
Obchodik[playerid] = 1;
                    }
                }
                else
                {
                }
            }
        }
    }
    return 
1;
}
    
    
stock IsNehnutelnostForSale(nehnutelnostid)
{
    new 
cesta[25];
    
format(cesta,25,"VRLS/Nehnutelnosti/%d.cfg",nehnutelnostid);
    if(
strcmp("none",DOF2_GetString(cesta,"Owner"), false) == 0) return true;
    return 
false;
}
stock GetPlayerNehnutelnost(playerid)
{
    for(new 
g=0;g<NehnutelnostCount+1;g++)
    {
        if(
IsPlayerInRangeOfPoint(playerid,2,NehnutelnostInfo[g][pX],NehnutelnostInfo[g][pY],NehnutelnostInfo[g][pZ]))
        {
            return 
g;
        }
    }
    return -
1;
}
stock PlayerName(playerid)
{
    new 
name[24], str[24];
    
GetPlayerName(playeridname24);
    
strmid(str,name,0,strlen(name),24);
    for (new 
024; ++i)
    {
        if (
str[i] == '_'str[i] = ' ';
        if (!
name[i])
        {
            break;
        }
        
name[i] &= 0xff;
    }
    return 
str;
}
stock PlayerIDs(string[])
{
    for(new 
070g++)
    {
        if(
IsPlayerConnected(g))
        {
            new 
name[24];
            
GetPlayerName(gname24);
            if(!
strcmp(namestringtrue))
            {
                return 
g;
            }
        }
    }
    return -
1;
}
stock GetWeaponSlot(weaponid)
{
   switch (
weaponid)
   {
       case 
0,1: return 0;
       case 
2..9: return 1;
       case 
10..15: return 10;
       case 
16..18,39: return 8;
       case 
22..24: return 2;
       case 
25..27: return 3;
       case 
28,29,32: return 4;
       case 
33,34: return 6;
       case 
35..38: return 7;
       case 
41..43: return 9;
       case 
44..46: return 11;
       default: return 
12;
   }
   return 
12;

Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
Well `stock` only applies to the function, not the parameters, so you will still get a warning for them.
hey hey yeah just now i'm not that when i press left alt so the dialogue does not show me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)