PDA

View Full Version : stock


EmpireSk
25/03/2019, 02:44 PM
I'm doing real estate and somehow I can't fix this how?


OnDialogResponse
new var1 = GetPlayerNehnutelnost(playerid);
new var2 = PlayerIDs(NehnutelnostInfo[var1][Owner]);



stock PlayerIDs(string) ///warning 203: symbol is never used: "string"
{
for(new g = 0; g < 70; g++)
{
if(IsPlayerConnected(g))
{
new name[24];
GetPlayerName(g, name, 24);
if(!strcmp(name, string, true)) /// error 035: argument type mismatch (argument 2)
{
return g;
}
}
}
return -1;
}

SiaReyes
25/03/2019, 02:53 PM
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;
}

iorp
25/03/2019, 03:13 PM
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;
}

EmpireSk
25/03/2019, 04:11 PM
What does this have to do with stock?
I can't even explain it myself :D :D


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


#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,nX, nY, nZ);
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(playerid, newkeys, oldkeys)
{
if(IsPlayerConnected(playerid))
{
if(newkeys == KEY_WALK)
{
for(new z = 0; z < NehnutelnostCount; z++)
{
if(IsPlayerInRangeOfPoint(z, 2, NehnutelnostInfo[NehnutelnostCount][pX], NehnutelnostInfo[NehnutelnostCount][pY], NehnutelnostInfo[NehnutelnostCount][pZ]) == 1)
{
if(!coze[z])
{
ShowPlayerDialog(playerid,DIALOG_NEHNUTELNOST,DIAL OG_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(var1, 200, "~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(z, var1, 5000, 1);
}
}
}
}
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch (dialogid)
{
case DIALOG_NEHNUTELNOST:
{
if(response == 1)
{
TogglePlayerControllable(playerid, true);
coze[playerid] = 0;
new var1 = GetPlayerNehnutelnost(playerid);
new var2 = PlayerIDs(NehnutelnostInfo[var1][Owner]);

if(listitem == 0)
{
new var3[128];
format(var3, 128, "Nemovitost %s ma prumerny vydelek %d$", NehnutelnostInfo[var1][Nazev], NehnutelnostInfo[var1][Cena] / 100);
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var3, 3000);
}
if(listitem == 1)
{
if(var2 != playerid)
{
if(NehnutelnostInfo[var1][Cena] <= GetPlayerMoney(playerid))
{
if(!Ochranka[var1])
{
new var3[128];
format(var3, 128, "Odkoupil jste nemovitost %s od vlastnika: %s", NehnutelnostInfo[var1][Nazev], PlayerName(playerid));
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var3, 3000);
Vysloto[playerid] = 0;
if(IsPlayerConnected(var2))
{
GivePlayerMoney(var2, NehnutelnostInfo[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(var3, 128, "[ ! ] Hrac %s(%d) vam odkoupil nemovitost %s", PlayerName(playerid), playerid, NehnutelnostInfo[var1][Nazev]);
SendClientMessage(var2, 0xEFEFF7AA, var3);
format(var3, 128, "Nemovitost byla odkoupena za %d$ a nevyzvednute penize byly zabaveny mestem", NehnutelnostInfo[var1][Cena]);
SendClientMessage(var2, 0xEFEFF7AA, var3);
}

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.0, 0, 1, 1, 4, -1);
}
}
else
{
new var3[128];
format(var3, 128, "Nemate dostatek penez pro koupeni %s.Je zapotrebi nejmene %d$", NehnutelnostInfo[var1][Nazev],NehnutelnostInfo[var1][Cena]);
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var3, 3000);
}
}
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(var3, 200, "Predali ste nemovitost ~r~%s. ~w~ Bolo vám vrátené %d$", NehnutelnostInfo[var1][Nazev], NehnutelnostInfo[var1][Cena]);
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var3, 3000);

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(var3, 128, "Nie si vlastnikom tento nehnutelnosti %s", NehnutelnostInfo[var1][Nazev]);
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var3, 3000);
}
}
if(listitem == 3)
{
if(playerid == var2)
{
if(0 < Vysloto[playerid])
{
new var3[200];
new Float:VydelkovySystem = floatround(random((Vysloto[playerid] / 7) + 100), 0);
format(var3, 200, "Nemovitost %s ma v trezoru %d$,bylo strzeno %d$ na udrzbu a vyplaty zamestnancu. Penize vam byly vyplaceny", NehnutelnostInfo[var1][Nazev], Vysloto[playerid] - VydelkovySystem, VydelkovySystem);
SendClientMessage(var2, 0xEFEFF7AA, var3);
VydelkovySystem = Vysloto[playerid] - VydelkovySystem;
GivePlayerMoney(playerid, VydelkovySystem);
Vysloto[playerid] = 0;
}
else
{
SendClientMessage(playerid, 0xEFEFF7AA, "Nemovitost nic nevydelala");
}
}
else
{
new var31[128];
format(var31, 128, "Nie si vlastnikom tento nehnutelnosti %s", NehnutelnostInfo[var1][Nazev]);
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var31, 3000);
}

}
if(listitem == 4)
{
if(playerid == var2)
{
coze[playerid] = 1;
ShowPlayerDialog(playerid, DIALOG_NEHNUTELNOST01, DIALOG_STYLE_INPUT, "Nehnutelnost - Investicia", "Sme zadajte sumu akú chcete zainvestovat", "Enter", "Zpäť");
}
else
{
new var31[128];
format(var31, 128, "Nie si vlastnikom tento nehnutelnosti %s", NehnutelnostInfo[var1][Nazev]);
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var31, 3000);
}
}

if(listitem == 5)
{
if(playerid == var2)
{
if(NehnutelnostInfo[var1][Vydelek] / 4 < GetPlayerMoney(playerid))
{
if(!Ochranka[playerid])
{
new var3[200];
format(var3, 200, "Nemovitost %s je nyni hlidana ochrankou, po dobu dalsich 60 minut. Zaplatil jste %d$", NehnutelnostInfo[var1][Nazev], floatround(NehnutelnostInfo[var1][Vydelek] / 40, 0));
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var3, 3000);
Ochranka[playerid] = Ochranka[playerid] + 60;
GivePlayerMoney(playerid, floatround(0 - (NehnutelnostInfo[var1][Vydelek] / 40), 0));
}
else
{
SendClientMessage(playerid, 0xEFEFF7AA, "[ ! ] Nemovitost uz je pod ochranou");
}
}
else
{
new var31[128];
format(var31, 128, "Nemate na zaplaceni %d$ za ochranku", floatround(NehnutelnostInfo[var1][Vydelek] / 4, 0));
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var31, 3000);
}
}
else
{
new var31[128];
format(var31, 128, "Nie si vlastnikom tento nehnutelnosti %s", NehnutelnostInfo[var1][Nazev]);
FormatPlayerInfoBox(playerid,"~g~Nemovitost",var31, 3000);
}
}
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", 1000, false, "i", playerid);
ApplyAnimation(playerid, "SHOP", "ROB_Loop_Threat", 5.5, 1, 1, 1, 1, 1);
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);
for(new ids = 0; ids < 70; ids++)
{
if(IsPlayerConnected(ids))
{
if(PlayerInfo[ids][Job] == 14 || PlayerInfo[ids][Job] == 10)
{
new var4[128];
format(var4, 128, "[ ! ] Zloděj %s vykrádá obchod %s", PlayerName(playerid), NehnutelnostInfo[var1][Nazev]);
SendClientMessage(playerid, 0x7171FFAA, var4);
}
}
}
}
}
else
{
FormatPlayerInfoBox(playerid,"~g~Nehnutelnost", "Nemozes si vyhradnut vlastnu nehnutelnost",4000);
}
}
}
}
case DIALOG_NEHNUTELNOST01:
{
if(response == 1)
{
new var1 = GetPlayerNehnutelnost(playerid);
TogglePlayerControllable(playerid, true);
coze[playerid] = 0;
if(var1 == -1)
{
return SendClientMessage(playerid, 0xEFEFF7AA, "[ ! ] Musite byt u nemovitosti");
}
if(GetPlayerMoney(playerid) < 10000)
{
SendClientMessage(playerid, 0xEFEFF7AA, "nemáš 10000");
}
else
{
NehnutelnostInfo[var1][Vydelek] = NehnutelnostInfo[var1][Vydelek] + 10000;
SendClientMessage(playerid, 0xEFEFF7AA, "dal si 10000");
}
}
if(response == 0)
{
ShowPlayerDialog(playerid,DIALOG_NEHNUTELNOST,DIAL OG_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(0 < Nastavcas20[playerid])
{
new var0[128];
format(var0, 128, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~r~Cas vykradani : ~w~%d", 20);
GameTextForPlayer(playerid, var0, 1100, 3);
Nastavcas20[playerid]--;
SetTimerEx("obchod", 1000, false, "i", playerid);
}
else
{
for(new g=0;g<NehnutelnostCount;g++)
{
if(IsPlayerInRangeOfPoint(playerid,2,NehnutelnostI nfo[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(playerid, GetPlayerWantedLevel(playerid) + 1);
format(var1, 128, "[ 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(0xFF0000AA, var1);
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,NehnutelnostI nfo[g][pX],NehnutelnostInfo[g][pY],NehnutelnostInfo[g][pZ]))
{
return g;
}
}
return -1;
}

stock PlayerName(playerid)
{
new name[24], str[24];
GetPlayerName(playerid, name, 24);
strmid(str,name,0,strlen(name),24);
for (new i = 0; i < 24; ++i)
{
if (str[i] == '_') str[i] = ' ';
if (!name[i])
{
break;
}
name[i] &= 0xff;
}
return str;
}

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;
}

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;
}

EmpireSk
25/03/2019, 07:30 PM
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